How to work with issue data in different contexts
The issue context provides a streamlined approach where fields are directly accessible, while dynamic context allows you to work with multiple issues simultaneously. Understanding these contexts is key to writing effective scripts.
This straightforward approach to issue contexts makes it easy to master SIL scripting with just a few examples. Once you understand when to use each context and the associated syntax, you'll be able to write powerful automation scripts for your Jira instance.
Working with dynamic context
Dynamic context in SIL scripts allows you to access and modify field values across multiple issues. This approach uses specific syntax to indicate which issue's fields you're reading from or writing to, enabling bulk operations and cross-issue automation.
Reading field values from other issues
Example 1: Reading values with dot notationstring[] issueKeys = selectIssues("project = Test");
for(string key in issueKeys) {
runnerLog(key + " - " + key.summary);
} | Uses simple dot notation ( The dot notation syntax ( |
Setting field values in other issues
Example 1: Writing values with substitution syntaxstring[] issueKeys = selectIssues("project = Test");
for(string key in issueKeys) {
%key%.labels = "newLabel";
} | Uses the substitution syntax with percent signs ( When updating field values in other issues, you must use the substitution syntax with percent signs ( |
Working with issue context
Scripts running in an issue context have direct access to all fields of that specific issue. This simplifies field access as you don't need to specify which issue you're working with - the current issue is automatically available.
Reading field values in issue context
Example 1: Reading values from current issuerunnerLog(assignee);
runnerLog(attachments);
runnerLog(description); | Directly accesses field values from the current issue without needing to specify an issue key or context. All standard and custom fields are immediately available by their names or aliases. For a full list of standard variables that are already ready for use when running in the context of an issue, see |
Setting field values in issue context
Example 1: Writing values to current issuedescription += "\nThis extra bit of text was added using SIL!"; | Directly modifies field values in the current issue without needing special syntax. You can read, write, or update any available field using simple variable references. This script assumes that it is running in the context of an issue, like in a workflow script or listener. When testing outside this native context in the SIL Manager, you must add an issue key in the Run Configuration settings to provide the necessary context. |