Forgive me if it comes up as a silly question since I am a complete beginner to Scriptrunner. I am trying to add the following validator script to Workflow but getting the following error.
Here 'Sub-Status' is a checkbox field having only 1 value 'On hold' currently.
Could you please help me with the solution?
Thanks and Regards
Thank you for your question.
I can confirm that the reason for your error is due to your validator expression is not valid code for Jira cloud and is groovy code that will only work on Jira server.
I can confirm that inside of Jira Cloud that validators are designed using the Jira Expression Framework and you would need to use this expression syntax to define the validator that you require.
I can confirm that we have a knowledge base article located here which explains how you can use this to create the validator that you want with ScriptRunner for Jira Cloud and I hope this helps to achieve your requirement.
I hope this information helps.
Hello @Kristian Walker _Adaptavist_ ,
Thank you for the above links.
I was able to find scripts related to labels, links, discription, sub-tasks etc. but unable to get anything regarding Checkboxes.
If possible, could you provide a code similar to cfValues['Sub-Status']*.value.contains("On hold") for JIRA cloud?
Thanks in advance,
Danish Hussain Sabunwala
I have added an example here on line 55 which shows gow to validate that a checkbox field must contain just a single value.
Please note if you need to change this example you will be able to modify this using the Jira Expression framework doucmentation as an example to help you to modify it using the Jira Expression framework doucmentation as a guide to help you to achieve this.
I hope this helps.
Hello @Danish Hussain Sabunwala ,
I'm no Scriptrunner expert either, but I think you can achieve what you want without using it !
You could use a simpler validator in your Jira Workflow called "Regular Expression Check". There, you simply have to select your Checkbox field, and enter the correct value the field must have to validate the transition.
Let me know if it helps,
For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events