Forums

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

Jira Misc Workflow Extensions: Groovy script to validate Checkboxes

Michael Reiff
Contributor
March 20, 2018

Scenario:

I have a CustomField of type Checkboxes "Check Variants". There are 3 values I can check: "Variant 1", "Variant 2" and "Variant 3".

A Transition should be allowed, when ""Variant 1" and "Variant 3" is select.  Selection of "Variant 2" doesn't matter.

I tried something with:

cfValues["Check Variants"]*.value.contains("Variante 3") 

but I'm afraid that JMWE is not able to deal with cfValues.

Question:

How gets the Groovy-Script to validate a transition, with a specific set of values from a Checkbox-Field?

 

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
March 20, 2018

Indeed, JMWE uses a different syntax to access field values. The rest is a matter of Groovy taste, I personally like this approach:

issue.get("Check Variants")*.value.containsAll(["Variant 1","Variant 3"])
Michael Reiff
Contributor
March 20, 2018

That was really fast. Thank you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events