The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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 Champions.
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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

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