Automation basics
Understand the general concepts and best practices of automation in Atlassian cloud products.
The following smart values are available to access and format text strings when setting up a rule. Check out how we use smart values in our Jira automation template library.
The examples below use the Summary field value of Hello World!.
Abbreviates the text string to the defined number of characters and adds "..." to the end. The maxLength parameter needs to be at least 4.
1
2
{{issue.summary.abbreviate(8)}} -> Hello Wo...
{{issue.summary.abbreviate(4)}} -> Hell...
For more information, see: StringUtils.abbreviate(int).
Takes a string, and converts it to a number if possible. Otherwise, returns null.
1
{{issue.summary.asNumber}} -> Null
Identifies the character at the specified position in the text string.
1
2
3
{{issue.summary.charAt(0)}} -> H
{{issue.summary.charAt(7)}} -> o
{{issue.summary.charAt(12)}} -> Null
For more information, see: String.charAt(int).
Capitalizes the first character.
1
{{issue.summary.capitalize()}} -> Hello world!
For more information, see: StringUtils.capitalize(String).
Adds a specified text string to the end of the returned value.
1
{{issue.summary.concat(" It's a beautiful day!")}} -> Hello World! It's a beautiful day!
For more information, see: String.concat(String).
Checks if the text string ends with the specified text, and returns true or false.
1
2
{{issue.summary.endsWith("World!")}} -> true
{{issue.summary.endsWith("World@")}} -> false
For more information, see: String.endsWith(String).
Takes a text field and checks if it is equal to the given string. Returns true if the strings are equal. Can be used in conditional logic.
1
2
{{issue.summary.equals(“Hello world!”)}} -> true
{{issue.summary.equals(“hello world!”)}} -> false
Takes a text field and checks if it is equal to the given string, regardless of case. Returns true if the strings are equal. Can be used in conditional logic.
1
2
3
{{issue.summary.equals(“Hello world!”)}} -> true
{{issue.summary.equals(“hello world!”)}} -> true
{{issue.summary.equals(“helloo world!”)}} -> false
Encodes text to allow it to be included in HTML content.
1
{{htmlEncode(issue.summary)}} -> Hello world!
Takes a text field that contains wiki markup and converts it to HTML or plain text. Read more about converting wiki markup to HTML
Returns the position of the first character in the specified text string.
1
2
3
{{issue.summary.indexOf("Wo")}} -> 6
{{issue.summary.indexOf("ello")}} -> 2
{{issue.summary.indexOf("d!")}} -> 11
For more information, see: String.indexOf(String).
Checks if the text contains only letters, and returns true or false.
1
{{issue.summary.isAlpha()}} -> true
For more information, see: StringUtils.isAlpha().
Checks if the text contains only letters or numbers, and returns true or false.
1
{{issue.summary.isAlphanumeric()}} -> true
For more information, see: StringUtils.isAlphanumeric().
Checks to see if the text is empty, and returns true or false.
1
{{issue.summary.isEmpty()}} -> false
For more information, see: StringUtils.isEmpty().
Checks to see if the text is not empty, and returns true or false.
1
{{issue.summary.isNotEmpty()}} -> true
For more information, see: StringUtils.isNotEmpty().
Checks if the text contains only numbers, and returns true or false.
1
{{issue.summary.isNumeric()}} -> false
For more information, see: StringUtils.isNumeric().
Encodes text to allow it to be included in JSON calls, for example, the send outgoing web request action.
1
{{issue.summary.jsonEncode}} -> Hello World!
View Json encoding below for details on encoding when sending outgoing webhooks as JSON.
Converts a JSON Formatted String into a JSON Object, who's keys can be accessed via Dot Notation.
1
{{jsonStringToObject(webResponse.body)}} -> {value=Hello World!}
Where the smart value for webResponse.body returned:
1
{"value": "Hello World!"}
Arrays of Arrays do not work, such as:
1
{"value": { {"key1": "val1", "key2": "val2"}, {"key3": "val3", "key4": "val4"} } }
But an Object of Arrays work:
1
{"value": [ {"key1": "val1", "key2": "val2"}, {"key3": "val3", "key4": "val4"} ] }
Returns the position of the last character in the specified text string.
1
2
3
{{issue.summary.lastIndexOf("wo")}} -> 7
{{issue.summary.lastIndexOf("ll")}} -> 4
{{issue.summary.lastIndexOf("rl")}} -> 9
For more information, see: string.lastIndexOf(String).
Returns the characters, from the specified amount of characters, from the left of the text string.
1
2
3
{{issue.summary.left(5)}} -> Hello
{{issue.summary.left(9)}} -> Hello Wor
{{issue.summary.left(2)}} -> He
For more information, see: StringUtils.left(int).
Adds characters to the beginning of the text until the specified total number of characters is reached.
1
2
{{issue.summary.leftPad(14, "-")}} -> --Hello World!
{{issue.summary.leftPad(20, "|")}} -> ||||||||Hello World!
For more information, see: StringUtils.leftPad(int, String).
Returns the number of characters in the text string.
1
{{issue.summary.length()}} -> 12
For more information, see: String.length().
Performs a regular expression search and returns the first (and only one) matching regular expression group.
The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches. If multiple matches are found, they return as a collection that can be iterated. This can be used to find a single pattern match (e.g. extract a version number from the issue description) or to match multiple patterns (e.g. extract all e-mail addresses from an issue comment).
1
{{issue.summary.match(".*(lo).*")}} -> lo {{issue.summary.match(".*(o).*")}} -> [o, o]
Escapes the smart value into a literal text expression that can be used in a regular expression match using Pattern.quote().
1
{{issue.summary.quote()}} -> \QHello(.*)World!\E<
Removes characters from text.
1
{{issue.summary.remove("l")}} -> Heo Word!
For more information, see: StringUtils.remove(String).
Replaces all literal text matches with a specified replacement.
1
{{issue.summary.replace("Hello","Goodbye")}} -> Goodbye World!
For more information, see: String.replace(String, String).
Performs a regular expression search and replaces any match with the replacement. $1 can be used to access a matching group in the replacement.
1
{{issue.summary.replaceAll("(lo)","xx$1yy")}} -> Helxxloyy World!
For more information, see: String.replaceAll(String, String).
Reverses the characters in the text string.
1
{issue.summary.reverse()}} -> !dlroW elloH
For more information, see: StringUtils.reverse().
Returns the characters, from the specified amount of characters, from the right of the text string.
1
{{issue.summary.right(6)}} -> World!
For more information, see: StringUtils.right(int).
Adds characters to the end of the text string until the specified total number of characters is reached.
1
{{issue.summary.<br/>rightPadPad(14,"-")}} -> Hello World!--
For more information, see: StringUtils.rightPad(int, String).
Splits the text and returns the word specified by the word's position in the text string.
1
{{issue.summary.split(" ").first}} -> Hello
For more information, see: String.split(String).
Checks if the text string starts with the specified text, and returns true or false.
1
{{issue.summary.startsWith("World!")}} -> false
For more information, see: String.startsWith(String).
Returns the characters after the amount of characters specified.
1
{{issue.summary.substring(7)}} -> orld!
For more information, see: StringUtils.substring(int).
Returns the characters at the positions specified.
1
{{issue.summary.substring(1,3)}} -> el
For more information, see: StringUtils.substring(int, int).
Returns the text after the first occurrence of the given separator.
1
{{issue.summary.substringAfter("W")}} -> orld!
For more information, see: StringUtils.substringAfter(String).
Returns the text after the last occurrence of the given separator.
1
{{issue.summary.substringAfterLast("o")}} -> rld!
For more information, see: StringUtils. substringAfterLast(String).
Returns the text before the first occurrence of the given separator.
1
{{issue.summary.substringBefore("W")}} -> Hello
For more information, see: StringUtils. substringBefore(String).
Returns the text before the last occurrence of the given separator.
1
{{issue.summary.substringBeforeLast("o")}} -> Hello W
For more information, see: StringUtils. substringBeforeLast(String).
Returns the text between the given parameters.
1
{{issue.summary.substringBetween("e","d")}} -> llo Worl
For more information, see: StringUtils. substringBetween(String, String).
Converts the text string to lower case.
1
{{issue.summary.toLowerCase()}} -> hello world!
For more information, see: String.toLowerCase().
Converts the text string to upper case
1
{{issue.summary.toUpperCase()}} -> HELLO WORLD!
For more information, see: String.toUpperCase().
Removes any whitespace at the beginning or end of the value.
1
{{issue.summary.trim()}} -> Hello World!
For more information, see: String.trim().
Encodes text to allow them to be included as a URL param, for example, a link in an email.
1
{{issue.summary.urlEncode}} -> See Encoding below.
Encodes text to allow them to be included in XML data, for example, an outgoing webhook.
1
{{issue.summary.xmlEncode}} -> See Encoding below.
When integrating with other systems or sending emails, you may need to encode the text to comply with standards or not break things. For example, if you are sending an HTML email, you may need to encode an issue's description as HTML. This escapes specific characters to comply with the HTML specifications.
HTML encoding is useful for emails and exporting HTML pages. For example, Waiting for R&D would be encoded as Waiting for R&D.
For security reasons, you should only use the function version, rather than the inline version. When sending a webhook response (that has a property called htmlEncode) in an email, encoding the response with {{webhookData.htmlEncode}} will return the value of the htmlEncode property instead of encoding the content of webhookData.
1
2
// Function
{{htmlEncode(issue.status.name)}}
Useful when sending outgoing webhooks as JSON. For example, "Hello World" would be encoded as \"Hello World\".
1
2
3
4
5
// Function
{{#jsonEncode}}{{issue.summary}}{{/}}
// Inline version
{{issue.summary.jsonEncode}}
Useful when sending creating links in emails. For example, Hello & World would be encoded as Hello+%26+World (the spaces become +, and the ampersand becomes %26).
1
2
3
4
5
// Function
{{#urlEncode}}{{issue.summary}}{{/}}
// Inline version
{{issue.summary.urlEncode}}
Useful when sending Outgoing webhooks as XML. For example, Hello & World would be encoded as Hello & World.
1
2
3
4
5
// Function
{{#xmlEncode}}{{issue.description}}{{/}}
// Inline function
{{issue.description.xmlEncode}}
Was this helpful?