GStringTemplateEngine

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, you want to create a Send Custom Email listener, you can write the Email template and Subject template using GString Templates.

Jira (will only be available in the Jira docs set)

  1. 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}
  2. 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.

Bitbucket (will only be available in the Bitbucket docs set)

The following example is for a custom email triggering on a fork repository event. 

  1. Enter the following into the Subject template field:

    Fork ${event.repository.project.key}/${event.repository.name} has just been created
  2. Enter the following into the Email template field:

    User ${event.user.displayName} has forked the repository ${event.repository.origin.project.key}/${event.repository.origin.name}. The name of the new repository is: ${event.repository.project.key}/${event.repository.name}

Confluence (will only be available in the Confluence docs set)

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.
On this page