Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Block transitions

Jovita Sajonaitė May 29, 2020

Hello,

I need a solution which blocks transition "Done and "Closed" when issues has specific value in field and is linked to specific issue type.

In other words: should not be possible to move Story to "Done" and "Closed" 

IF Risk = High and Severity = Extensive and issue is linked to Change request.

Is it possible to do that with the script runner?

Any examples of the code?

Thank you :)

2 answers

1 accepted

0 votes
Answer accepted
PD 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.
June 1, 2020

Sure it's possible.

But you probably need 2 workflow validators. One for each transition (to done and to closed). You can use a single script file and link it from both transitions.

So in each of those transitions, add a validator and select "Simple Scripted Validator" then either paste or point to file with

def isHigh = cfValues['Risk']?.value == 'High'
def isExtensive = cfValues['Severity']?.value == 'Extensive'
def isLinkedToRFC = issueLinkManager.getLinkCollectionOverrideSecurity(issue).allIssues.any{
it.issueType.name=="Change request"
}
!(isHigh && isExtensive && isLinkedToRFC)

Then add the message you wish to display when all 3 are true 

0 votes
Jovita Sajonaitė June 1, 2020

Hello,

Perfect!!! 
I modified it, since we have two Risk fields, so I added additional lines.

You helped me a lot, it works, thank you!

Suggest an answer

Log in or Sign up to answer