Triggering Transitions by using a custom field

Liron Cohen October 19, 2013

I want to create a field called "Risk" field - meaning if fixing this bug or adding this feature is risky or not. (Low, Medium, High)

What I want is that when the risk is "High" I want another transition to be execute into a step called approval - that will give a user with the rule Approver the ability to decline/approve the task.

Only after the task(fixing the bug or adding the feature) is approved the status will continue to next step.

(Please also if you can add an explanation how to allow only someone with the "role" Approver to be able to approve the task)

If the risk is Medium or Low it will continue without transition to the next step.

Thank you in Advance,

Cohen Liron

2 answers

1 accepted

1 vote
Answer accepted
Sergio October 20, 2013

What you have to do is to ban the next transition if your risk is High. You can do it by adding a new Condition on your transition which checks your custom field value.

Let's say your workflow is now like this: "A --> B --> C", but you want this for High risk issues: "A --> B --> Approval --> C"

In this example, you should ban the transition "B --> C" if the issue is in High risk, allowing the transition "B --> Approval" in this case. Both transitions "B --> C" and "B --> Approval" would appear on your workflow design.

Regarding your question about the role "Approver", it is another condition on your transition "Approval --> C". The type of condition is "User is in Project Role".

Have a look to JIRA documentation on configuring workflows.

Cheers

Sergio

Liron Cohen October 21, 2013

Are you reffering to the "Value Field Condition" in "Jira Suit Utilities"?

The basic Jira (5.1) don't have that feature.

The "Jira Suit Utilities" did the trick. I'll post later how I have implemented the solution.

Thank you very much!

Sergio October 21, 2013

Yes, you're right. I installed that plugin so early in my implementation that I consider it as part of JIRA core, although it is not :)

Good luck! You'll get it, it's not a big deal.

Liron Cohen November 5, 2013

Solution was as Sergio suggested.

Using the Field "Risk" and adding a transition to "Need Approval" state.

  • Inside the transition I added condition if "Risk" is "High"

Added another transition to "In Progress"

  • The condition to it was that "Risk" is not "High"

Adding a "Role" called "Approvers" and adding users there.

From state "Need Approval" created 2 transitions - "Deny" and "Approve"

  • Both has a condition that only user from role "Approvers" can initiate it.

Reopen Issue problem:

  • What happend if issue was opened, needed approval, was approved and then (after 0 or more steps) closes.
  • If we wanted to "Reopen" the issue we will need to re-Approve it.

Solution:

  • I've created new field called "Approved" and configured it to "Yes" and "No" (select list) - and made the default as "No"
  • The new field will not be visible in any of the screens.
  • To the "Need Approval" transition I've added: and "Approved" is "No"
  • To the "In Progress" transition I've added: or "Approved" is "Yes"
  • This will make the transition to "In Progress" if the issue was approved before (The field actually save the state of the approval without letting the user change it
  • In order for user to see this field I've created new screen (duplicated the original) and added the field - The screen was assigned only to the "View Issue" - so the user can't edit it yet he can see it.

Sergio thank you very much - You've helped me alot.

Like Berenberg_io Team likes this
1 vote
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 21, 2013

You may need a listener, not a condition, to transition it automatically to the Approval state. If not, you can stick to the condition

Check this, even if you're not using our plugins, you can borrow the idea: http://confluence.kepler-rominfo.com/display/TR/Start+progress+on+an+issue+only+after+the+approval+of+project+manager

Liron Cohen November 5, 2013

Thank you Radu on this link - This is a very interesting solution here.

Right now the "Jira Suite Utilities" was already installed before and I was instructed not to add any more addons to the system.

In any case thank you and I will use this information if the future.

Suggest an answer

Log in or Sign up to answer