Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Abstract

This code snippet concatenates two text fields ignoring null values

...

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

The output of this code is a String which you could, for example use to:

  • Set the summary of the issue to the concatenation of two custom field values, say Customer Name and Machine details 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
Code Block
languagejs
linenumberstrue
org.codehaus.groovy.runtime.NullObject.metaClass.toString = {return ''}
linkedIssueissue.get("description").toString(Customer Name") + "\n-" + issue.get("summaryMachine details")

...

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 theInclude the key and description of the issue in the comment while notifying the customer that their issue has been resolved in one of 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
Code Block
languagejs
linenumberstrue
org.codehaus.groovy.runtime.NullObject.metaClass.toString = {return ''}
"Your issue" + issue.getKey() + " - " + issue.get("descritpion") + " has been resolved."
  • Compare the text in a conditional execution script to:
    • Run a post-function
    • Run a condition
    • Run a validator
    • Unlink issues

Use cases

...

Reference

...