Forums

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

copy values from subtask to parent task during subtask closure

Swarna Radha
Contributor
November 14, 2019

Hi,

I want to copy values from subtask to parent task via script runner during subtask closure.

 

Please find the code below:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue


def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject('customfield_16011')
//def parentMyFieldValue = issue.parentObject.getCustomFieldValue(field)
def changeHolder = new DefaultIssueChangeHolder();

 

if (! issue.isSubTask()) {
return true
}

def parent = issue.parentObject
! parent.subTaskObjects.any { subtask ->
subtask.getCustomFieldValue(cf)
}

cf.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cf), parent),changeHolder);

 

I am getting error upon execution. Kindly advice.

 

Thanks,

Swarna

 

0 answers

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