Using GString Templates

ScriptRunner allows you to write Groovy scripts with dynamically generated text using GString TemplatesYou 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.

The following example is for a custom email triggering on a space created event. 

  1. Enter the following into the Subject template field:

    New space ${event.space.name} created
  2. Enter the following into the Email template field:

    Dear ${event.user.displayName} A new space ${event.space.name} has been created.