Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Default
SQL that will be used when not using individual operations like get, insert, update, etc.
Example:
Code Block |
---|
SELECT id, year, make, model FROM auto_info WHERE year = {:2} AND make = {:3} AND model = {:4} |
Get
SQL used to determine how data will be retrieved from the database.
Example:
Code Block | ||
---|---|---|
| ||
SELECT id, year, make, model FROM auto_info WHERE year = {:2} AND make = {:3} AND model = {:4} |
Set
SQL code used to determine how data will be set in Jira, not the database.
Insert
SQL code used to determine how data will be inserted into the database.
Example:
Code Block | ||
---|---|---|
| ||
INSERT INTO auto_info(id, year, make, model) VALUES ({:1}, {:2}, {:3}, {:4}) |
Update
SQL code used to determine how data will be updated in the database.
Example:
language | js |
---|
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.
Image Added
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, name FROM countries WHERE id = {:1} |
Delete
SQL code used to determine how data will be deleted from the database.
Example:
Code Block | ||
---|---|---|
| ||
DELETE FROM auto_info WHERE id = {:1} |
Search
SQL code used to determine how data will be searched in the database.
Example:
Code Block | ||
---|---|---|
| ||
SELECT id, year, make, model FROM auto_info WHERE model ~ {:4} |
Seq
SQL code used to determine a sequence value for the ID when inserting new values into the database. If not specified, it will try to use the value provided in the inputs, and if that does not exist, it will rely on the database to have a mechanism for the ID.
ExampleImage AddedSET
The SET script
INSERT
The INSERT script is triggered every time
UPDATE
DELETE
SEARCH
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:
Code Block |
---|
SELECT MAX(id), name FROM countries WHERE autois_info eu = true |
SEQ
Contents
Table of Contents |
---|
See More
Child pages (Children Display) | ||||
---|---|---|---|---|
|