How to write condition for workflow transition that has linkage between epic and story?

Kha Hoang April 22, 2022

Hi All,

I was setup my Jira to have the following hierarchy:

Portofilo Epic -> Feature Epic -> Story -> Sub-task.

Portofilo Epic is a parent link of Feature Epic,

Feature Epic is a Epic link of the story.

The Feature Epic and Story requires some status relationship. It means that Story can't move to Ready until Feature Epic status is in Ready.

How do I write a condition in the workflow to handle that?  I know I will have to write a JQL Query to do that but I'm not understand enough to write one for it.

Please Help!  Thank you.

1 answer

0 votes
Peter-Dave Sheehan
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.
April 22, 2022

Just to be clear, you want a condition script so that the workflow transition is not visible for Story unless the linked Epic is also in Ready status?

A simple scripted condition should work for this. 

cfValues['Epic Link'].status.name == 'Ready'
Kha Hoang April 22, 2022

Yes, that is correct.  Or it could error out and stop the story to move to forward state. how of I add OR statement to it?
Epic Link status equal Ready or Implement then story can move to Ready

I think your scripted condition above should work for me in that 1 case.


Thank you

Peter-Dave Sheehan
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.
April 22, 2022

When I have multiple clauses I like to separate them like this:

//if you need to compare a singel value against a list you can use the "in" operator in groovy
def okStatusList = ['Ready', 'Implement']
def parentStatusIsOk = cfValues['Epic Link'].status.name in okStatusList
def otherCriteria = <expression that returns a true or false>

//evaluate the criteria if both must be true
parentStatusIsOk && otherCriteria

//evalue the criteria is either must be true
parentStatusIsOk || otherCriteria

If you want to display the button and provide a visual warning for the user, then put the same script in a simple scripted validator instead. Otherwise, the user may not understand why sometimes the button is visible and not other times.

Kha Hoang April 22, 2022

Thank you.  That would do it.  I will try it out.

Kha Hoang April 22, 2022

@Peter-Dave Sheehan- Thank you so much, it works exactly as what I expected and yes, I put it in the validator so that end-users get the popup message tell them what to do.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events