Forums

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

Use ScriptRunner Behaviours to update value of parent custom field to subtask custom field

Jeremy Johnson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 5, 2018

Goal:

I would like to have a behaviour on change script that updates the custom field of subtasks to the value that the parent updated to.  This is a free-text field entitled "Issue".

What I have tried:

Created a behaviour script for the Issue field, set to required (under Add Ons > Behaviours > [this project]).  So essentially this should run whenever that field is updated.

def subTasks = issue.getSubTaskObjects()
def issueValue = getFieldById(getFieldChanged())
subTasks.each {
it.getFieldByName("Issue").setFormValue(issueValue.getFormValue())
}

*this is the entirety of the code in the script for the Issue custom field on change listener

This produces no results.

When I check the atlassian logs, there are no errors shown, either.

Thanks in advance for any insight you can offer.

1 answer

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
July 5, 2018

I'm not sure but I think you should use setCustomFieldValue.

it.setCustomFieldValue(issueValue.getFormValue())

Suggest an answer

Log in or Sign up to answer