1
votes

In a JIRA workflow, I would like to automatically execute several transitions one after the other when a certain condition is triggered. How can I do that ?

I have set up a Jira workflow that includes the following statuses - ToDo (new issue) - Ready (work planned) - InProgress (ongoing work) The normal course of action is to go from ToDo to Ready (is ready transition) and then from Ready to InProgress (start progress transition).

Whatever the current status (ToDo or Ready) of the issue, I would like to move it to InProgress when a branch is created in Bitbucket or a commit is created. That means that if the issue is in the ToDo status, creating a branch or adding a commit should automatically execute is ready and right after that start progress.

Note that I do not want to create any additional transition straight from ToDo to InProgress.

I have tried setting the branch created and commit created triggers on both is ready and start progress. But the best I achieve is to execute a single transition.

1

1 Answers

1
votes

Note that I do not want to create any additional transition straight from ToDo to InProgress.

This is basically how Atlassian has designed the workflow and Issue transition logic, you're fighting against the system here.

I don't know if you also consider this as creating an additional transition but what you can do is link the already existing start progress transition to both Ready and ToDo statuses and add the branch hook to that one.

EDIT:

Well, I thought about this a bit more. What you can do is add a Webhook as a Post Function to the is ready transition. You would of course need to build an endpoint that accepts the Webhook and then, after checking that all the conditions pass, take that same Issue and transition it again to InProgress. This endpoint can either be a separate web-server or also a custom JIRA plugin, by the way.

This is what I could come up with limited to JIRA's default functionality. Depending on whether you're running a Server or Cloud instance there might be existing add-ons that provide you with this functionality but I cannot say for certain - you'd need to dig around at Atlassian Marketplace.

If, for example, you have the Script Runner add-on installed you could add a generic Post Function.. function to the issue which can execute any kind of code, you can replace the Webhook endpoint with that function.