Abstract
This code snippet concatenates two text fields ignoring null values
Logic
Access the text fields and concatenate them
Snippet
org.codehaus.groovy.runtime.NullObject.metaClass.toString = {return ''} <First text field> + "<Delimiter>" + <Second text field>
Placeholders
Placeholder | Description | Example |
---|---|---|
<First text field> | Accessing the first text field | linkedIssue.get("description").toString() |
"<Delimiter>" | Delimiter separating the text fields | "\n" |
<Second text field> | Accessing the second text field | issue.get("summary") |
Examples
org.codehaus.groovy.runtime.NullObject.metaClass.toString = {return ''} linkedIssue.get("description").toString() + "\n" + issue.get("summary")
Context
The output of this snippet is a String which you could use:
- To set a Text field in:
- one of the Set Field Value post-functions
- one of the Transition issue post-functions on the transition screens, if any
- the Create issue post-function under Set fields of new issue section
- To include the text in the
- Comment in one of the Comment issue post-functions
- Subject/HTML body/Text body of Email issue post-function
- JQL search expression of Link issues current to issue
- In a conditional execution script to
- Run a post-function
- Unlink issues
Use cases
A typical use case would be to add the summary of the sub-task to the description of the parent - On the creation of a sub-task add its summary to the description of its parent
Reference
Related articles
Filter by label
There are no items with the selected labels at this time.