• Community
  • Products
  • Jira Software
  • Questions
  • When a user clicks "Approve" I want to transition to Status A if Field X has value of "A" and Status B if Field X has value of "B". What's the best way to accomplish this?

When a user clicks "Approve" I want to transition to Status A if Field X has value of "A" and Status B if Field X has value of "B". What's the best way to accomplish this?

Charles Breland December 9, 2016

I'm trying to send an issue to one of two statuses based off of a value that the person sets on transition. Basically, the scenario is I am building an approval workflow where a request goes through 3 different approver steps. In this one step, 2 different people have to approve (and not in any particular order). So, if User A approves and sets that value to A, I want to transition the issue to a status that is "waiting for user B"..and vice versa. Any help would be appreciated. 

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 9, 2016

Create two transitions, one with end point A, and a condition saying "field x is A", and a similar transition for the Bs

Charles Breland December 9, 2016

Hey, thanks so much for the quick response. I should have provided a little more info though. This isn't for a project team, but is something we're delivering to business customers. So, we were hoping to avoid having to tell them to "Click Edit ->Go To the Review Tab -> Set the Field Value -> Click Update" series of events. So, we'd tried the method you recommend, but decided that wasn't the user experience we wanted. What we want is for the user to go to the issue, click approve, we pop up the intermediary screen, they say "User A Approves" or "User B Approves" and then Submit. This keeps them from having to go into the edit issue mode and find the fields they need to update and things. 

We are actually open to using your ScriptRunner product if that would allow an easier way to do this. What we were thinking is that we would set a post-condition that would check the field (to see if it had value A or value B) and then route to status A or status B accordingly (when the user clicked to Submit their approval). Make sense? We just don't have the experience scripting for things like this. Thanks!!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 9, 2016

No.  Well, not directly.  A transition only has one end-point.  If you use transition A, it's always going to land in status A.  With Script Runner, what you can do is detect the condition, let it transition to A and then immediately transition to B

However, I'd do it completely differently. 

  • Add an "approved by" multi-user picker field which is not on the edit screens
  • Have a transition back to the current unapproved state
    • Use SR to create a condition of "current user not in 'approved by' field"
    • Use SR to create a post-function that adds "current user" into the "approved by" field
  • Have a second transition that goes to the approved status
    • It needs the two conditions the other transition does, plus
    • Use SR to have a condition on it that says "number of approvers = (required - 1)"

Suggest an answer

Log in or Sign up to answer