Simple scripted validator

Is there a way to check of a "non-custom" field has a particular value?

I want to make sure the "Resolution" is "Not an Issue", but the script

cfValues['Resolution'] like 'Not an Issue'

does not work - it also does not complain that 'Resolution' is apparently not in "cfValues".

Is there a construct available for referencing the "Resolution"?

Thanks - jOhn -

 

2 answers

1 accepted

Actually exactly the opposite - the "Resolution" must be "Not an Issue".
To clarify (using our state names, which are irrelevant to the problem):
during a transition from "Verification" to "Cancelled",
the action "Set Issue to Cancelled" shall be possible only if "Resolution" is "Not an Issue".
I was using the

  • Workflow > Transition "Set to Cancelled" > Validator:
  • Build-in Scripts: Simple scripted validator: "Has a custom field equal to"

but since "Resolution" is not a custom field, this was not working.

I was hoping for a simple way to access the value of "Resolution", and your code did the trick after changing it to

issue.resolution?.name == 'Not an Issue'

Thanks - jOhn -

In a different approach, since the transition accepts only one resolution, you could just add a post function that set the resolution to "Not an Issue" instead of using a validator.

I guess the idea is to make the user really aware of what s/he is doing when cancelling an Issue after it has already been "integrated" and "verified" (those are the transitions we have after "opened").

I had also thought of that type of post function, but the stakeholders went with the validator.

if i get it right you want to have a validator that will be evaluated to true only if issue resolution is not "Not an issue"

Then you have to add the following code in transitions that you set the resolution

issue.resolution?.name != 'Not an Issue'

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

763 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you