Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

copy values from subtask to parent task during subtask closure

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you