Forums

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

checking a checkbox field of a parrent issue in a post function of an epic

andres jerez
June 10, 2021

Hi, im trying to update a checkbox custom field that only has a value ("Lost") on a parent issues right after i update one of the epics to a particular status in our kanban board, but no matter which configuration of the "Set field value post-function" in the JMWE i use, it still never changes, in the value field i was trying something like {{targetIssue.fields["Lost"] | join("," , "Lost")}},  but no changes, i tried, also just to let the value field like "Lost" but also didnt work. what could i be doing here wrong?

 

As a target issue i have: issues that belong to the current issue Epic.

Field: Lost

Value: (i tried multiples as mentioned)

1 answer

1 vote
Mahesh S
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 Champions.
September 27, 2016

Please use this as a reference.

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField approvalNeeded = customFieldManager.getCustomFieldObjectByName("Approval Needed")
 
String value = (String) issue.getCustomFieldValue(approvalNeeded)

Now, the value of Approval needed into the variable 'value' and go ahead with further coding as you required.

Jonny Carter
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 Champions.
September 28, 2016

Here's the same script, with imports and more relaxed typing:

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def approvalNeeded = customFieldManager.getCustomFieldObjectByName("Approval Needed")
def value = issue.getCustomFieldValue(approvalNeeded)

See also the examples using the OptionsManager to show you how to get the list of possible values for your select list field. https://scriptrunner.adaptavist.com/4.3.7/jira/recipes/behaviours/select-list-other.html. You probably won't need them for your use case, but you may for similar work.

Suggest an answer

Log in or Sign up to answer