Forums

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

Help creating validator

Francisco Fuentes February 5, 2024

Is it possible to create a validator (using a JMWE script), use it in a transition and have it add users (only add, not delete) in a Multiple Pick User Custom Field and keep the original user from being modified? Any ideas on what script I could use to achieve this?

 

Custom Field I'm using:

image.png

1 answer

1 accepted

1 vote
Answer accepted
David Fischer
Community Champion
February 5, 2024

Hi @Francisco Fuentes 

you can create a Scripted Validator with the following code:

issue.get("My user picker")?.containsAll(originalIssue.get("My user picker"))

Note that you cannot test this script using the Test Groovy Script button, you can only test that the validator actually works (because the originalIssue variable only works during an actual transition)

Francisco Fuentes February 6, 2024

Thank you for your input. Sadly, the code provided results in the following error. I wonder why that is. Any clues? Also, This is for Jira Data Center.

 

image.png

 

 

David Fischer
Community Champion
February 6, 2024

Hi @Francisco Fuentes 

As I mentioned in my answer, you cannot test the script using the script tester, you need to deploy the validator and test the transition. 

Like Francisco Fuentes likes this
Francisco Fuentes February 6, 2024

You are correct, my bad. It worked, thank you for your help!

David Fischer
Community Champion
February 6, 2024

I'm glad it worked!

Can you please "accept" the answer so that others can benefit from it?

Like Francisco Fuentes likes this
Francisco Fuentes February 6, 2024

Done. Thanks!

Suggest an answer

Log in or Sign up to answer