Skip to end of banner
Go to start of banner

Configuring scripts for read-only fields

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

The operations supported by read-only fields are: DEFAULT, GET and SEARCH.

Configuring a read-only field via the Configuration Wizard will only generate the GET and SEARCH scripts. This is just a starting point, feel free to adjust the scripts according to your needs for the field.

DEFAULT

The DEFAULT script is triggered when creating an issue and you have to configure it if you want to initialize the field with a default value. The default value is set only if no other value is manually selected for the field in the Issue Create screen.

Important: you have to refer to the same columns previously defined in the Columns tab. The output of this script has to respect the names, data types and exact order in which the columns are configured.

SQL Example: Let’s assume you want to initialize the Country field for all newly created issues with the value 'Germany'. You will have to configure the DEFAULT script like this:

SELECT id, name FROM countries WHERE name = 'Germany'

GET

The GET script is triggered when the field is displayed in a Jira page. The frequency with which it runs depends on the Refresh type that is configured for the field (https://appfire.atlassian.net/wiki/spaces/PSJ/pages/540574265/General+settings+for+read-only+fields#Refresh-type ).

Important: you have to refer to the same columns previously defined in the Columns tab. The output of this script has to respect the names, data types and exact order in which the columns are configured.

Important: the column set as Primary Key should be the only parameter used by this script, to ensure the uniqueness of the result.

SQL Example:

SELECT id, name FROM countries WHERE id = {:1}

The SEARCH script is triggered every time the field has to display the list of possible values for the user to select from.

Important: you have to refer to the same columns previously defined in the Columns tab. The output of this script has to respect the names, data types and exact order in which the columns are configured.

SQL Example: Let’s assume you want to use as options in your field only countries that are members of the European Union (having the is_eu flag set to true in the table of origin). You will have to configure the SEARCH script like this:

SELECT id, name FROM countries WHERE is_eu = true

  • No labels