You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I use post function Fires an event when condition is true. Event = issue Assigned. In WF i got "Create issue" - status "Open" - status "To do". I need issue to be in the status "to do" if there is an assignee. Can you help me with script to use to move issue to a status "To do".
Hi Stanislav, I was able to do something similar to what you are looking for via a Listener, configured to trigger for 'Issue Updated' events :
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueManager = ComponentAccessor.issueManager
def issue = issueManager.getIssueObject(event.issue.key)
IssueService issueService = ComponentAccessor.getIssueService()
def actionId = 21 // change this to the step that you want the issues to be transitioned to
def transitionValidationResult
def transitionResult
if (issue.getAssignee() != null) {
transitionValidationResult = issueService.validateTransition(currentUser, issue.id, actionId, new IssueInputParametersImpl())
if (transitionValidationResult.isValid()) {
transitionResult = issueService.transition(currentUser, transitionValidationResult)
}
}
What it does is it checks if the issue has an assignee, and if it does, then whenever the issue is updated, it would perform the transition specified in the actionId (you can find the action ID for the transaction that you want when viewing/editing the workflow, as in the image below :
So in my workflow, the transition action ID to transition an issue to 'In Progress' is 21, so by specifying 21 in the code it knows which transition to perform. You will need to find the action ID specific to your workflow/transition and edit the code accordingly, but it should fulfill what you are looking for.
Hi
What I understand is, you want to transition automatically an issue when issue is assigned, right?
In this case, I would recommend to you to use Automation for Jira instead os scriptrunner, will be easier to configure and maintain.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right but we dont have Automation for Jira in our company we are using scriptrunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.