Simple Scripted Validator not working

I am trying to use the Simple Scripted Validator to require field entry based upon a custom cascading select field.

I am using the one of the example conditions provided by ScriptRunner:

cfValues['System']?.get(null) == 'ERP'

This condition is not accepted and it shows the following tool tip error:

[Static Type Checking] - Cannot find matching method java.lang.object#get(<unknown parameter type>).  Please check if the declared type is right and if the method exists.  Possible solutions: grep(), getAt(java.lang.string), grep(java.lang.object), wait(), any(), wait(long) @ line 1, column 1.

Other simpler conditions like == 'Bug' accept without error.

What is the cause for the error and how do I resolve it?

2 answers

This widget could not be displayed.

It's the null in the .get I think.  The get should be fetching an element from the array in the field, but feeding it with null does not make sense.

Try .get(1) instead

It still errors with .get(1)

Cannot find matching method java.lang.object#get(int).

Ah, sorry, I missed the "field is cascading select", which may make it harder and means I need to ask more questions.

What version of JIRA are you using?  And what is the cascading pair you are trying to find?  By pair, I mean if you had a cascading select for "country" and the user selected the USA, the drop-down would list all the states.  Are you looking for the USA/UK/France/Indonesia part alone, or are you looking for USA: California?

Thanks for you quick feedback.

I'm using JIRA Core 7.3.1, JIRA Service Desk 3.3.1 and Adaptavist ScriptRunner 4.3.19.

I've tried to use the first element of the array and bot elements of the array based upon the examples provided online.

I only need to validate the first element of the cascade select (USA in your example).

Hi Nic - Do you have any updates / suggestions on this issue?

This widget could not be displayed.


Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

594 views 25 15
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