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, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events