Variable resolution
This page explains how Simple Issue Language (SIL ™) identifies and accesses different types of variables in scripts. It covers standard Jira fields, custom fields, and user-defined variables while providing detailed guidance on various referencing methods and pre-declared variables.
Basic concepts
Variable resolution is how SIL identifies and accesses different types of variables in your scripts - whether they're standard Jira fields, custom fields, or your own variables. Understanding variable resolution is crucial for writing effective SIL scripts, as it determines how you can reference and manipulate issue data.
Variables in SIL can be standard Jira fields, custom fields, or user-defined variables.
Resolution refers to how SIL finds and accesses these variables.
Context determines how you can reference variables:
Implicit reference (in issue context) is used when your script runs in the context of a specific issue.
Explicit reference (any context) is used when you need to reference specific issues or related issues.
To learn more about context, see the Issue context page.
Issue reference in SIL
Pre-declared variables are automatically available in SIL scripts, letting you access information about issues using either direct field names or through specialized issue reference syntax patterns.
Standard (pre-declared) variables
SIL automatically pre-declares all standard issue variables and their synonyms. For example:
key
represents the issue keyid
represents the issue IDsummary
represents the issue summary
Don’t redeclare these pre-declared variables; this will cause errors in your code.
Specialized issue reference syntax patterns
SIL provides three ways to reference and access issue data through specialized syntax patterns.
Reference | Syntax pattern | Description |
---|---|---|
Parent issue reference |
|
Exampleparent.id // Parent issue's ID
parent.summary // Parent issue's summary
parent.status // Parent issue's status
// Example usage
if (parent.status == "Done") {
summary = "Parent is completed: " + parent.summary;
} |
Direct issue reference |
|
ExamplePROJ-123.id // Specific issue's ID
PROJ-123.summary // Specific issue's summary
PROJ-123.assignee // Specific issue's assignee
// Example usage
PROJ-123.assignee = currentUser();
PROJ-123.labels += "needs-review"; |
Substitution |
|
Examplestring k = "PROJ-123";
%k%.reporter = currentUser(); // Sets reporter on PROJ-123
%k%.summary = "Updated Summary"; // Sets summary on PROJ-123 Here’s how it works:
|
Field reference in SIL
SIL provides flexible ways to access both standard and custom Jira fields through different reference methods.
Variable substitution
Variable substitution is a mechanism in SIL that lets you dynamically access fields using variables. Instead of directly referencing a field name, you can store the field name in a variable and use that variable to access the field. It uses the basic syntax %variableName%
.
When SIL encounters %variableName%
, it performs two steps:
Step 1: SIL reads the value stored in the variable.
Step 2: SIL uses the retrieved value as the field name to access.
Examples
This basic example illustrates the variable substitution mechanism:
These examples illustrate the two common use cases for variable substitution:
Custom field access
Dynamic field updates
This example shows how to validate variables and check if a field exists:
Custom fields
In addition to standard issue fields, SIL provides three ways to access custom fields:
By field ID
By field name
By field alias (if configured)
Examples
This example shows three ways of accessing a custom field:
Standard variables reference
These standard variables represent core issue data like summary, description, and status. They are already pre-declared in SIL. When your script runs in an issue context, you can use these variables directly without specifying an issue. However, outside of issue context, you must explicitly reference the issue context.
Variable | Aliases | SIL type | Read-only | Explanation |
---|---|---|---|---|
|
|
|
| The affected versions field of the issue |
| none |
|
| Username of the assignee of the issue |
|
|
|
| The filenames of the attachments |
|
|
|
| The components of the issue |
| none |
|
| Timestamp of the date when the issue was created |
|
|
|
| The description of the issue |
|
|
|
| The due date of the issue |
|
|
|
| Remaining estimate |
|
|
|
| The environment of the issue |
|
|
|
| Target fix versions of the issue |
| none |
|
| Internal issue ID |
| none |
|
| Username of the creator |
|
|
|
| The name of the issue type |
| none |
|
| The ID of the issue type |
| none |
|
| The issue key |
| none |
|
| The labels of the issue |
|
|
|
| The original estimate of the issue |
| none |
|
| The parent issue key |
| none |
|
| The ID of the parent issue |
|
|
|
| The name of the issue priority level |
| none |
|
| The ID of the issue priority level |
|
|
|
| The project key |
| none |
|
| The internal ID of the project |
| none |
|
| Username of the reporter |
|
|
|
| The name of the resolution state |
|
|
|
| The ID of the resolution state |
| none |
|
| The current resolution date |
|
|
|
| The name of the security level |
|
|
|
| The ID of the security level |
| none |
|
| The name of the current status |
| none |
|
| The ID of the current status |
| none |
|
| The summary of the issue |
|
|
|
| Total logged time on the issue |
| none |
|
| Last update timestamp It will update automatically after the current transition. |
| none |
|
| The number of votes this issue has |
| none |
|
| The usernames of the watchers of the issue |
|
|
|
| The workflow scheme name applied to the issue |
| none |
|
| The workflow Scheme ID applied to the issue |