Parameters usage examples

User

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

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

  • displayName = $user.displayName

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

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'))


Empty/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'))