Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The operations supported by generic fields are: DEFAULT, GET, SET, INSERT, UPDATE, DELETE, SEARCH and SEQ.
Configuring a read-only field via the Configuration Wizard will only generate the GET, INSERT, UPDATE, DELETE 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 that for all newly created issues, you want to initialize the Country field with the corresponding values of the table record that has ‘Germany' value in the 'name’ column. You will have to configure the DEFAULT script like this:
Code Block |
---|
SELECT id, code, name, independence, gdp_capita, capital, is_eu 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.
SQL Example:
Code Block |
---|
SELECT id, code, name, independence, gdp_capita, capital, is_eu FROM countries WHERE id = {:1} |
SET
The SET script
INSERT
The INSERT script is triggered every time the Insert action is completed.
If the security configured for the field (https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482145/General+settings+for+generic+fields#Security-Type ) allows it, users are able to insert new rows in the database. Clicking on the following icon:
will render a form with inputs corresponding to the columns in the field configuration. Submitting this form, which can be done either using ‘Insert only’ or ‘Insert & Set’ buttons, will run the INSERT script, providing it with the values filled in the form.
The parameters to be used in the INSERT script should be coded like: {:1}, {:2} etc. which, at runtime, will receive the form value for the field’s column with the specified index.
Important: you have to refer to the same columns previously defined in the Columns tab and make sure you are using the correct index equivalent.
SQL Example: If you want to allow adding new rows to your table, you have to configure the INSERT script like this:
Code Block |
---|
INSERT INTO countries(id, code, name, independence, gdp_capita, capital, is_eu) VALUES ({:1}, {:2}, {:3}, {:4}, {:5}, {:6}, {:7}) |
UPDATE
The UPDATE script is triggered every time the Update action is completed.
If the security configured for the field (https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482145/General+settings+for+generic+fields#Security-Type ) allows it, users are able to update existing rows in the database. Clicking on the following icon:
will render a form with inputs corresponding to the columns in the field configuration.
Submitting this form will run the UPDATE script, providing it with the values filled in the form.
The parameters to be used in the UPDATE script should be coded like: {:1}, {:2} etc. which, at runtime, will receive the form value for the field’s column with the specified index.
Important: you have to refer to the same columns previously defined in the Columns tab and make sure you are using the correct index equivalent.
SQL Example: If you want to allow updating rows from your table, you have to configure the UPDATE script similar to this:
Code Block |
---|
UPDATE countries SET code = {:2}, name = {:3}, independence = {:4}, gdp_capita = {:5}, capital = {:6}, is_eu = {:7} WHERE id = {:1} |
DELETE
The DELETE script is triggered every time the Delete action is completed.
If the security configured for the field (https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482145/General+settings+for+generic+fields#Security-Type ) allows it, users are able to delete existing rows from the database. Clicking on the following icon:
will ask for confirmation to delete the currently selected row. Accepting it will run the DELETE script, providing it with values present in the field.
The parameters to be used in the DELETE script should be coded like: {:1}, {:2} etc. which, at runtime, will receive the value for the field’s column with the specified index.
Important: you have to refer to the same columns previously defined in the Columns tab and make sure you are using the correct index equivalent.
SQL Example: If you want to allow deleting rows from your table, you have to configure the DELETE script similar to this:
Code Block |
---|
DELETE FROM countries WHERE id = {:1} |
SEARCH
The SEARCH script is triggered every time the field has to display the list of possible values for the user to select from.
If the security configured for the field (https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482145/General+settings+for+generic+fields#Security-Type ) allows it, users are able to search and set values for the field in Jira. Clicking on the following icon:
will open a dialog in which the SEARCH script will be run, providing it with values present in the dialog.
The parameters to be used in the SEARCH script should be coded like: {:1}, {:2} etc. which, at runtime, will receive the value for the field’s column with the specified index.
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 search criteria the code and name of the countries and you want to search for countries having a code or name that contains the values entered in the screen inputs. You will have to configure the SEARCH script like this:
Code Block |
---|
SELECT id, code, name, independence, gdp_capita, capital, is_eu FROM countries WHERE code LIKE '%' || {:2} || '%' OR name LIKE '%' || {:3} || '%' |
SEQ
Contents
Table of Contents |
---|
See More
Child pages (Children Display) | ||||
---|---|---|---|---|
|