Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Smart Fields in Automation for JIRA also support a number of string manipulation functions.  This works with any 'text' type field such as summary, description, and text custom fields.  You can also use string manipulation functions on issue sub-attributes, such as the {{issue.fields.reporter.displayName}}.

Supported functions

We support the following methods.

FunctionField valueExample usageExample outputFurther documentation
abbreviate(int maxLength)Hello World!{{issue.summary.abbreviate(8)}}Hello...

Abbreviates a String using ellipses. This will turn "Now is the time for all good men" into "Now is the time for..."

See StringUtils.abbreviate(int) for full details.

chartAt(int index)Hello World!{{issue.description.charAt(2)}}eSee String.charAt(int) for full details.
capitalize()hello world!{{issue.summary.capitalize()}}Hello world!See StringUtils.capitalize(String) for full details.
concat(String str)Hello{{issue.summary.concat(" World!")}}Hello World!See String.concat(String) for full details.
endsWith(String str)Hello World!{{issue.summary.endsWith("World!")}}trueSee String.endsWith(String) for full details.
indexOf(String str)Hello World!{{issue.summary.indexOf("Wo")}}6See String.indexOf(String) for full details.
isAlpha()Hello World{{issue.summary.isAlpha()}}trueChecks if the String contains only Unicode letters. See StringUtils.isAlpha() for full details.
isAlphanumeric()Hello World123{{issue.summary.isAlphanumeric()}}trueChecks if the String contains only Unicode letters or digits. See StringUtils.isAlphanumeric() for full details.
isEmpty()Hello World!{{issue.summary.isEmpty()}}falseChecks to see if the string is empty - "". See StringUtils.isEmpty() for full details.
isNotEmpty()Hello World!{{issue.summary.isNotEmpty()}}trueChecks to see if the string is not empty - "". See StringUtils.isNotEmpty() for full details.
IsNumeric()Hello World{{issue.summary.isNumeric()}}falseChecks if the String contains only digits. See StringUtils.isNumeric() for full details.
lastIndexOf(String str)Hello World!{{issue.summary.lastIndexOf("o")}}7See String.lastIndexOf(String) for full details.
left(int length)Hello World!{{issue.summary.left(5)}}HelloReturns the number of chars specified from the left of the string. See StringUtils.left(int) for full details.
leftPad(int length, String pad)Hello{{issue.summary.leftPad(8, "-")}}---HelloAdds the specified string until the source is of the length specified See StringUtils.leftPad(int, String) for full details.
length()Hello World!{{issue.summary.length()}}12See String.length() for full details.
match()
  • Hello World!
  • _Andreas_ and _Nick_
  • {{issue.summary.match(".*(lo).*")}}
  • {{issue.summary.match("_([^_]*)_")}}
  • lo
  • [Andreas, Nick]

Performs a regular expression search and will return 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 will be returned 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).

quote()Hello(.*)World!{{issue.summary.quote()}}\QHello(.*)World!\EEscapes the smart value into a literal string expression that can be used in a regular expression match using Pattern.quote().
remove(String remove)Hello World!{{issue.summary.remove("l")}}Heo Word!See StringUtils.remove(String) for full details.
replace(String target, String replacment)Hello World!{{issue.summary.replace("Hello", "Goodbye")}}Goodbye World!Replaces all literal string matches with the replacement. See String.replace(String, String) for full details.
replaceAll(String regex, String replacement)Hello World!{{issue.summary.replaceAll("(lo)", "xx$1yy")}}Helxxloyy World!Performs a regular expression search and replaces any match with the replacement. $1 can be used to access a matching group in the replacement. See String.replaceAll(String, String) for full details.
reverse()Hello World!{{issue.summary.reverse()}}!dlroW elloHSee StringUtils.reverse() for full details.
right(int length)Hello World{{issue.summary.right(5)}}WorldReturns the number of chars specified from the right of the string. See StringUtils.right(int) for full details.
rightPad(int length, String pad)Hello{{issue.summary.rightPadPad(8, "-")}}Hello---Adds the specified string until the source is of the length specified See StringUtils.rightPad(int, String) for full details.
substring(int start)Hello World!{{issue.summary.substring(7)}}orld!See StringUtils.substring(int) for full details.
substring(int start, int end)Hello World!{{issue.summary.substring(1,3)}}elSee StringUtils.substring(int, int) for full details.
substringAfter(String separator)Hello World!{{issue.summary.substringAfter(" ")}}World!Returns the string after the first occurrence of the given separator. See StringUtils.substringAfter(String) for full details.
substringAfterLast(String separator)Hello World!{{issue.summary.substringAfterLast("o")}}rld!Returns the string after the last occurrence of the given separator. See StringUtils.substringAfterLast(String) for full details.
substringBefore(String separator)Hello World!{{issue.summary.substringBefore(" ")}}HelloReturns the string before the first occurrence of the given separator. See StringUtils.substringBefore(String) for full details.
substringBeforeLast(String separator)Hello World!{{issue.summary.substringBeforeLast("o")}}Hello WReturns the string before the last occurrence of the given separator. See StringUtils.substringBeforeLast(String) for full details.
substringBetween(String open, String close)Hello World!{{issue.summary.substringBetween("e", "d")}}llo WorlReturns the string between the given parameters. See StringUtils.substringBetween(String, String) for full details.
split(String separator)Andreas Knecht{{issue.reporter.displayName.split(" ").first}}AndreasSee String.split(String) for full details.
startsWith(String str)Hello World!{{issue.summary.endsWith("World!")}}falseSee String.startsWith(String) for full details.
toLowerCase()Hello World!{{issue.summary.toLowerCase()}}hello world!See String.toLowerCase() for full details.
toUpperCase()Hello World!{{issue.summary.toUpperCase())}}HELLO WORLD!See String.toUpperCase() for full details.
trim()Hello World!{{issue.summary.trim()}}Hello World!Removes any whitespace at the beginning or end of the value. See String.trim() for full details.

Functions can also be chained so you can do something like:

{{issue.summary.toLowerCase().substring(0, 10).concat("!!")}}



Can't find what you're looking for here?

Please contact us via support or ask in the Atlassian community and we'll try to help you out!

  • No labels