Forums

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

What is the code to add a component when a standard task is spun off?

Nancy Bonanno
Contributor
May 7, 2020

I have to put a postfunction on a create transition that spins off another standard issue in the same project.  It needs to add a component to the spun-off ticket.  I can clone the ticket fine but when I add this code (stolen from a spin-off-a-SUBTASK postfunction), the whole thing dies with "issue=null."   Does anyone know the right code?  Thank you.

issue.summary = 'Chesapeake Center Catering Request'
import com.atlassian.jira.component.ComponentAccessor;def p = issue.getProjectObject()def c = ComponentAccessor.getProjectComponentManager().findByComponentName(p.getId(), "Conference Event Catering")
if (c) {
issue.setComponent([c])
issue.setAssigneeId(c.lead)
}

0 answers

Suggest an answer

Log in or Sign up to answer