Forums

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

Validate Priority for a specific Issue Type

Jason Galea
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.
January 23, 2020

Hi,

I would like some help to create a validator on a transition screen.

When an issue type is support, a priority will need to be selected.

The currently values of the priorities are P1, P2, P3 P4 and N/A.

Is there to validate (for the issue type 'Support Request' only. That N/A cannot be selected?

I tried using this method from the simple scripted validator but it still passes when selecting N/A.

issue.issueType.name == 'Support Request' && issue.priority?.name != 'NA' || issue.issueType.name == 'Incident'

Any ideas?

Cheers,
Jason

1 answer

1 accepted

1 vote
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.
January 23, 2020

Hi @Jason Galea 

Could it be as simple as a typo between the priority value of "N/A" and the the script using "NA"?

Other than that, your simple scripted validator seems fine.

To test it, go to the scriptrunner console and add try the following (put an issue key with priority is NA)

import com.atlassian.jira.component.ComponentAccessor

def issue = ComponentAccessor.issueManager.getIssueObject('JSP-4500')
issue.priority.name

 When it runs, you will see the exact value that you should compare. 

Then you can add your simple scripted validator script line before that and see what it returns and try a few different combinations.

Jason Galea
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.
January 24, 2020

Good one Peter-Dave! it was supposed to be set as "N/A"

Suggest an answer

Log in or Sign up to answer