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.
Function | Field value | Example usage | Example output | Further documentation |
---|---|---|---|---|
chartAt(int index) | Hello World! | {{issue.description.charAt(2)}} | e | See String.charAt(int) for full details. |
concat(String str) | Hello | {{issue.summary.concat(" World!")}} | Hello World! | See String.concat(String) for full details. |
indexOf(String str) | Hello World! | {{issue.summary.indexOf("Wo")}} | 6 | See String.indexOf(String) for full details. |
length() | Hello World! | {{issue.summary.length()}} | 12 | See String.length() for full details. |
match() |
|
|
| 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!\E | Escapes the smart value into a literal string expression that can be used in a regular expression match using Pattern.quote(). |
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. |
substring(int start) | Hello World! | {{issue.summary.substring(7)}} | orld! | See String.substring(int) for full details. |
substring(int start, int end) | Hello World! | {{issue.summary.substring(1,3)}} | el | See String.substring(int, int) for full details. |
split(String separator) | Andreas Knecht | {{issue.reporter.displayName.split(" ").first}} | Andreas | See String.split(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!