Standard Variables and Variable Resolution
Referencing an Issue
By default, the issue standard variables are pre-declared along with their synonyms. For instance,the key is an issue standard variable. You should avoid to re-declare it, since it will lead to subtle errors. We recommend you to prefix your variables with certain string if you are unsure of its name.
There are certain constructs that reflect the issue structure, for instance:
parent.id - refers to the parent id, and it is valid only if this issue is a subtask
TSTP-123.id - refers to the issue TSTP-123 id (on the project TSTP)
%k%.id - (Substitution, see below) refers to the issue designed by k, where k is a string variable already defined, containing a valid issue key, like in this example:
string k = "TSTP-123";
%k%.reporter = currentUser();
Tip
You will see the last construct comes in hand when used in cycles (for, while, do-while) or when creating an issue from SIL.
Substitution
It often happens that you need the value of a variable designated by another value. For example, we might have a custom field that specifies what certain data other field contains. The general syntax for substituting variables is:
%varname%
The above expression will evaluate to the value designated by the variable name contained inside the value of varname.
Example
string myCustomField = "customfield_10000"; // myCustomField is a local variable
%myCustomField% = "a value";
Note
While is a very powerful mechanism, please check the substitution variables before they are interpreted as variables. Having an uninitialized or an empty substitution is bad practice.
Standard Variables
Here is a list of the variables that are already defined in a SIL environment and that you can use right away. Note that these are all standard issue fields.