validating multi check box custom field using script runner plugin

Akhil Kanaskar March 18, 2014

Hi,

I have a multi check box custom field 'DOD' , which has options/items as start,stop,resolve.

Now what i want to implement is whenever a user tries to close a issue he should have atleast ticked start in custom field, if he has done so he will be able to close issue else he wont.

For this i am using script runner plugin and implemented a workflow validator on close issue as 'simple scripted validator' .

The condition in this simple scripted validator i have put is show below

cfValues[DOD] == 'start'

However this doesnt seems to work and although if the user ticks the 'start' in customfiled DOD he is not able to close issue.

Can someone please help me?

Regards,

Akhil

4 answers

1 accepted

0 votes
Answer accepted
RambanamP
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.
March 18, 2014
cfValues['DOD']*.value.contains("start")

try something like above code

Akhil Kanaskar March 18, 2014

Thanks .... that worked

But if i want to check all options then below command doesnt work ...Any idea

cfValues['DOD']*.value.contains("start","stop","resolve")

JamieA
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.
March 19, 2014

cfValues['DOD']*.value in ['start', 'stop', 'resolve']

Akhil Kanaskar March 19, 2014

This also doesnt work for me .... i still see errors in log

2014-03-20 10:24:19,074 http-bio-8080-exec-19 ERROR admin 624x502x1 kffx3j 127.0.0.1 /secure/CommentAssignIssue.jspa [atlassian.jira.workflow.OSWorkflowManager] Caught exception while attempting to perform action 2 from workflow 10300 on issue 'COR-1'

[InvalidInputException: [Error map: [{}]] [Error list: [[error 101]]]

JamieA
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.
March 20, 2014

In condition tester run:

cfValues['DOD'].value*.value.contains("start")

and provide the output here. I didn't really read your question properly - you just want to ensure that at least "start" is checked? If so I think the above should do it.

Akhil Kanaskar March 20, 2014

Hi Jamie,

I want to check that all three options(start,stop,resolve) of the DOD custom field should be checked, and only if all 3 options are present then only the transition would happen else it should fail

Kathryn Allison December 19, 2014

How do I say does not contain?

JamieA
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.
December 20, 2014

! cfValues['DOD'].value*.value.contains("start")

0 votes
Akhil Kanaskar March 24, 2014

see attached screenshot below for TICK-5 in which i have checked all 3 options, so as per my understanding the result should evaluate to true but thats not the case.

0 votes
Akhil Kanaskar March 24, 2014

Hi Jamie,

Below is the output of cfValues['DOD']*.value in ['start', 'stop', 'resolve'] in condition tester.

0 votes
Akhil Kanaskar March 24, 2014

Hi jamie,

Below is the output from condition tester on an issue

javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: value for class: Script1

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events