Using GString Templates
ScriptRunner allows you to write Groovy scripts with dynamically generated text using GString Templates. You can add dynamic text in a template using the ${expression}
syntax. All editors supporting GString Templates in ScriptRunner have Code Insight, allowing you to utilize code completions, parameter hints, and Javadoc lookup.
Below we show a simple example of how you can use GString Templates in ScriptRunner.
For example, if you want to create a Send Custom Email listener, you can write the Email template and Subject template using GString Templates.
Enter the following into the Email template field:
Dear ${issue.assignee?.displayName}, The ${issue.issueType.name} ${issue.key} with priority ${issue.priority?.name} has been assigned to you. Regards, ${issue.reporter?.displayName}
Enter the following into the Subject template field:
Issue ${issue.key} has been assigned to you.
For help with using the Java API see our Introduction to Atlassian Java API.