Forums

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

How to add Groovy condition for a checkbox field in post function

anil musunuru
Contributor
December 20, 2018

I have a Custom Field ID=11111 ,Custom field Name=Test , Checkbox Values =Apple,Oranges,Lemon.

I am writing a groovy condition expression where if it has one of the above values it should return TRUE, but instead it always returns FALSE, here is what i am using as condition expression 

issue.get("customfield_11111") == "Apple"

2 answers

0 votes
anil musunuru
Contributor
December 21, 2018

This worked for me,

issue.get("Customfield Name")?.find() { it.getValue() == "Customfield Value" } != null)

0 votes
Peter Bengov
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, 2018

Hi Anil,

Per Jamie's answer here, you should do the following: 

sourceValue = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_11111"))

if (['sourceValue']*.value.contains("Apple")) { ... }

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, product operations, product ops, linkedin live, atlassian events, cross-functional collaboration, product management, engineering collaboration, design collaboration, atlassian learning, agile teams, product strategy

Product Ops Unpacked: 4️⃣ tips every product pro needs to know ✍️

Join PM Evangelist, Axel Sooriah, & Product Ops. Consultant & Advisor, Jenny Wanger, as they unpack the role of product ops and discuss key takeaways in Atlassian’s ‘The Product Ops Mission’ guide. They’ll answer your questions live on May 6 at 9:00am PT.

Register here ⬇️
AUG Leaders

Atlassian Community Events