Skip to main content
Skip table of contents

Dependencies on the user input

In Jira, limiting the number of options available in select lists for custom fields is important for both user experience and system reliability.

When too many options are available, several challenges can arise:

  • Usability: Too many options can make the field hard to use.

  • Performance: A large number of options can cause performance issues.

  • API restrictions: Some APIs limit the number of values they return in one call.

Additionally, Elements Connect custom fields and connected items can only display up to 1000 items at once.

Delaying the request until the user has typed a minimum number of characters helps reduce the dataset and ensures complete results. To do this, it’s necessary to apply a filter before sending the request, using the $userInput dependency .

The examples below illustrate how $userInput can be implemented in SQL queries and REST API requests.

Example: Customers

Consider a custom field for "Customer" with many different company names sourced from a CRM. There can be thousands of company names, making it cumbersome to search through all options. To address this, you can configure the field to filter options based on user input.

For example, if you start typing "Acme" for "Acme Corporation", the field will only search for company names in the data source that contain "Acme".

SQL example configuration:

CODE
SELECT name FROM customers WHERE company_name ILIKE '%' || '$userInput' || '%'

When the user types "Acme", the executed SQL query will be:

CODE
SELECT name FROM customers WHERE company_name ILIKE '%' || 'Acme' || '%'

This query ensures that as the user types, the options are filtered to match the input dynamically. This approach is particularly useful for very large datasets that cannot be fully queried at once.

REST API example configuration:

CODE
GET /api/customers?name=$userInput*

When the user types "Acme", the executed REST API request will be:

CODE
GET /api/customers?name=Acme*

An additional advantage of using $userInput in a REST API context is that most APIs return a limited number of options (e.g., 100). Filtering the results with $userInput is the only way to access specific values within large datasets efficiently.

Conclusion

By dynamically filtering options based on user input, you can enhance both usability and performance in Jira custom fields. Whether using SQL queries or REST APIs, this approach ensures that only relevant options are presented to the user, improving the overall experience.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.