Versions Compared

Key

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

User

  • assignee = $issue.assignee or {{issue.assignee}}

  • reporter = $issue.reporter or {{issue.reporter}}

  • displayName = $user.displayName

  • userDisplayName = $ComponentAccessor.getUserManager().getUserByName("someUser").getDisplayName() 

Table of Contents

Date

Issue date fields

  • updated = $issue.updated

  • created = $issue.created

Formatting date

  • formattedDate = $DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format($issue.created)

Custom field values

  • productName = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_11100'))

  • price = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_11102'))

Utils

  • jsonEscapedString = $Utils.jsonEscape($issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_12500')))

Comment

Getting comment which is passed through the transition

  • comment = $comment 

Field changes in transition

$issue.get..  methods might return the old or new values within transition depending on the location of the post function.

Assume that we have a transition which uses a transition screen in which customfield_10123 can be changed.

  • If the REST Service Caller post function is before the "Update change history for an issue and store the issue in the database." post function, then $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10123')) call would return the old value
  • If the REST Service Caller post function is after the "Update change history for an issue and store the issue in the database." post function, then $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10123')) call would return the old value

But, what if we need both values? 

You can use transientIssue for the updated fields within transition instead of issue

  • productName = $transientIssue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10123'))

Line breaks

You can remove line breaks with the replaceAll() method

  • description = $issue.description.replaceAll("\n", "")

Render Options

You can render parameters in HTML or Plain Text.

  • HTML render → $wikiUtils.wikiToHtml($comment)
  • Plain Text render → $wikiUtils.wikiToText($comment)



Warning
titleEmpty/Null values

Simply add ! after $ sign, if the result can be empty or null. Otherwise, it will display the command as is (e.g. $issue.assignee)

Null safe usage:  $!issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_xx'))