groovy Validator JMWE

Jacob francois July 23, 2019

I am checking if a custom field has a certain value.

I am using JMWE

originalIssue.getAsString("customfield_23400") == "Add New Vendor"

 

The custom field is a dropdown. 

I can also use scriptrunner if its easier. 

1 answer

0 votes
Andrew
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 Leaders.
July 23, 2019
Jacob francois July 23, 2019

I tried :

 

cfValues['My Single Select']?.value == "Some value"

 

and still doesn't work. I get errors. 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 23, 2019

cfValues is only for ScriptRunner, and afaik doesn't work like that. In JMWE for Jira Server, your first attempt was correct except you probably meant to use "issue", not "originalIssue" (which contains the values before the transition):

issue.getAsString("customfield_23400") == "Add New Vendor"

Jacob francois July 23, 2019

@David Fischer  I tried it with issue and still doesn't work. 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 23, 2019

You created a Scripted (Groovy) Validator? Can you share your whole script? Also, did you make sure that the value you're testing doesn't have a trailing space in the custom field configuration?

Jacob francois July 23, 2019

@David Fischer it was a space issue. 

Suggest an answer

Log in or Sign up to answer