Workflow post function to set resolution only if triggered by specific trigger

Julian Davchev November 19, 2019

Hi guys,

 

I have a little specific case, that I want to think is actually quite common but still cannot automate. 

 

So setup is Cloud Jira + Cloud Bitbucket. I have setup workflow transition triggers so that once a PR is merged I resolve the ticket. 

 

The thing is I cannot make it so that on resolving the ticket it sets a resolution "Done" and I end up with status resolved without setting the resolution.

 

If I just implement Post function to set this to Done, then it will get resolution Done regardless if triggered by the "PR is merged" trigger or if I manually modify the ticket.

 

How would you suggest I approach this case.

 

Help much appreciated.

Best,

JD

1 answer

1 accepted

0 votes
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 20, 2019

Hi @Julian Davchev ,

Jira natively does not have a conditional option that can be set based on a trigger event, and there is some discussion on the same use case recommending the third party tool ScriptRunner as an option to accomplish this in the following thread, However the method described is one of the apps built in scripts, that I cannot verify wether it exists in the tool or not so it may not be avaliable on the Cloud version as discussed in "Why are built in scripts in ScriptRunner for Jira Cloud limited" , the post can be seen at the following link and would be one option to look into if the function is also avaliable in the Cloud version:

But for your noted use case a native option that might work out via the workflow would be to set up a two different transitions to the done status, one to be used by the trigger including the post function setting the resolution, and the other used when manually transiting in the instance so that a Resolution can be set manually.  Then on the transition used by your trigger set up the "Hide From User Condition" (Additional details on avaliable conditions can be seen in "Advanced workflow configuration: Conditions" )  So that the Transition is not avaliable to anyone on the front end but is still avaliable to the trigger in the backend as this condition can still be triggered from a workflow function or from REST calls.

Regards,
Earl

Julian Davchev November 21, 2019

That is some awesome advice Earl! Thanks a lot for the hint!

Like Earl McCutcheon likes this

Suggest an answer

Log in or Sign up to answer