Jira smart values - text fields

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!.

abbreviate(int maxLength)

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).

asNumber

Takes a string, and converts it to a number if possible. Otherwise, returns null.

1 {{issue.summary.asNumber}} -> Null

charAt(int index)

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).

capitalize()

Capitalizes the first character.

1 {{issue.summary.capitalize()}} -> Hello world!

For more information, see: StringUtils.capitalize(String).

concat(String str)

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).

endsWith(String str)

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).

equals(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

equalsIgnoreCase(string)

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

htmlEncode()

Encodes text to allow it to be included in HTML content.

1 {{htmlEncode(issue.summary)}} -> Hello world!

html render

Takes a text field that contains wiki markup and converts it to HTML or plain text. Read more about converting wiki markup to HTML

indexOf(String str)

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).

isAlpha()

Checks if the text contains only letters, and returns true or false.

1 {{issue.summary.isAlpha()}} -> true

For more information, see: StringUtils.isAlpha().

isAlphanumeric()

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().

isEmpty()

Checks to see if the text is empty, and returns true or false.

1 {{issue.summary.isEmpty()}} -> false

For more information, see: StringUtils.isEmpty().

isNotEmpty()

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().

isNumeric()

Checks if the text contains only numbers, and returns true or false.

1 {{issue.summary.isNumeric()}} -> false

For more information, see: StringUtils.isNumeric().

jsonEncode()

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.

lastIndexOf(String str)

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).

left(int length)

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).

leftPad(int length, String pad)

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).

length()

Returns the number of characters in the text string.

1 {{issue.summary.length()}} -> 12

For more information, see: String.length().

match()

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]

quote()

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<

remove(String remove)

Removes characters from text.

1 {{issue.summary.remove("l")}} -> Heo Word!

For more information, see: StringUtils.remove(String).

replace(String target, String replacement)

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).

replaceAll(String regex, String replacement)

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).

reverse()

Reverses the characters in the text string.

1 {issue.summary.reverse()}} -> !dlroW elloH

For more information, see: StringUtils.reverse().

right(int length)

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).

rightPad(int length, String pad)

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).

split(String separator)

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).

startsWith(String str)

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).

substring(int start)

Returns the characters after the amount of characters specified.

1 {{issue.summary.substring(7)}} -> orld!

For more information, see: StringUtils.substring(int).

substring(int start, int end)

Returns the characters at the positions specified.

1 {{issue.summary.substring(1,3)}} -> el

For more information, see: StringUtils.substring(int, int).

substringAfter( String separator)

Returns the text after the first occurrence of the given separator.

1 {{issue.summary.substringAfter("W")}} -> orld!

For more information, see: StringUtils.substringAfter(String).

substringAfterLast(String separator)

Returns the text after the last occurrence of the given separator.

1 {{issue.summary.substringAfterLast("o")}} -> rld!

For more information, see: StringUtils. substringAfterLast(String).

substringBefore(String separator)

Returns the text before the first occurrence of the given separator.

1 {{issue.summary.substringBefore("W")}} -> Hello

For more information, see: StringUtils. substringBefore(String).

substringBeforeLast(String separator)

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).

substringBetween(String open, String close)

Returns the text between the given parameters.

1 {{issue.summary.substringBetween("e","d")}} -> llo Worl

For more information, see: StringUtils. substringBetween(String, String).

toLowerCase()

Converts the text string to lower case.

1 {{issue.summary.toLowerCase()}} -> hello world!

For more information, see: String.toLowerCase().

toUpperCase()

Converts the text string to upper case

1 {{issue.summary.toUpperCase()}} -> HELLO WORLD!


For more information, see: String.toUpperCase().

trim()

Removes any whitespace at the beginning or end of the value.

1 {{issue.summary.trim()}} -> Hello World!

For more information, see: String.trim().

urlEncode()

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.

xmlEncode()

Encodes text to allow them to be included in XML data, for example, an outgoing webhook.

1 {{issue.summary.xmlEncode}} -> See Encoding below.

Encoding

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

HTML encoding is useful for emails and exporting HTML pages. For example, Waiting for R&D would be encoded as Waiting for R&amp;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)}}

Json encoding

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}}

URL encoding

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}}

Xml encoding

Useful when sending Outgoing webhooks as XML. For example, Hello & World would be encoded as Hello &amp; World.

1 2 3 4 5 // Function {{#xmlEncode}}{{issue.description}}{{/}} // Inline function {{issue.description.xmlEncode}}

 

Additional Help