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 2 Next »

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

When configuring a read-only field via the Configuration Wizard , only the GET and SEARCH scripts will be filled.

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.

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 has to be displayed in a Jira page. The frequency with which it runs depends on the Refresh type that is configured (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 one used by this script, to ensure the uniqueness of the result.

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.

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