Versions Compared

Key

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

...


Below, there is a sample code on how you can type your own script.

Code Block
languagegroovy
firstline1
titleExecute Code
linenumberstrue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().loggedInUser
log.info("current user:" + currentUser.username)
def reporter = issue.reporter.username
log.info("reporter: " + reporter)
return reporter.equals(currentUser.username)

...

Headers code example;

Code Block
firstlinetitle1Headers
titlelinenumbersHeaderstrue
Accept=application/json

Request body code example;

...

Code Block
titleParameters
linenumberstrue
assignee    = $issue.assignee or {{issue.assignee}}
reporter    = {{issue.reporter}}
date        = $issue.created
formattedDate = $DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format($issue.created)
productName = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_11100'))
price       = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_11102'))
displayName = $user.displayName
userDisplayName = $ComponentAccessor.getUserManager().getUserByName("someUser").getDisplayName() // you can also use ComponentAccessor
comment     = $comment // this is the comment that is passed through the transition

...