Hey Community,
I'm trying to use a post function to create a new issue during a workflow transition. Here's my set up:
First Task: ABC-1
During a transition of this First Task, a new issue gets created with a Linked Relationship "is blocked by." I'll call this one the Second Task, ABC-2.
When this Second Task is marked Done, I want a third issue to be created. I'll call this the Third Task, ABC-3. This Third Task should be created with a link to the First Task (as "blocks").
So ABC-1 is blocked by ABC-2. When ABC-2 is transitioned to Done, it creates ABC-3, which also blocks ABC-1. So ABC-1 cannot be done until these other two are finished.
The issue I'm having trouble with is getting ABC-3 to be created with a link to ABC-1. I ended up storing the Parent Link value (ABC-1) on ABC-2, so I had some way to track it.
I set up a Post Function for ABC-2, and here's what it looks like:
// Set the Issue Summary
issue.summary = "Review: ' + sourceIssue.summary
// Set the Assignee
issue.assigneeId = 'firstname.lastname'
issue.reporter = sourceIssue.assignee
// Set the Original Estimate of the New Ticket to 30 Minutes
issue.setOriginalEstimate(30*60)
// Grab the Parent Link of this Ticket
def ParentLink = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Parent Link'}
issue.setCustomFieldValue(ParentLink, sourceIssue.getCustomFieldValue(ParentLink))
// Use the Parent Link to Create a Link of this new issue to the original Parent
linkIssue(issue.id, ParentLink,"blocks")
I have an error on that last line with no help indicating the problem. Any advice?