Groovy Script For Function

PostFunction-groovy script : That is, you can add a post-function of a custom groovy script to the workflow, and use the groovy script in the groovy editor to implement your custom needs.

How to add groovy script ?

(1) Click Add post-function

 


(2) Select the custom groovy script and click Add


(3) Enter name and script to run


(4) Click Add and publish the workflow


(5)When this transformation is performed in the issue interface, the custom script in the post-function is automatically executed

 


Code examples

① Assign the current logged-in user as the assignee

import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.user.ApplicationUser // get current user def loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() as ApplicationUser; if(Objects.nonNull(loggedInUser)){ issue.setAssignee(loggedInUser); }