Forums

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

JIRA Portfolio: epic link vs parent link

Shawn Danisa August 6, 2019

 I would like to update the Parent Link when cloning a ticket.  I added a script runner post function to clone a ticket. In the additional issue section, I added the following script: 

 

import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

UserMessageUtil.success('Fieldwork Epic, created successfully.')
issue.summary = 'FieldWork: ' + sourceIssue.summary

def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Issue Key'}

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def parentIssue = issueManager.getIssueObject(cf) // Parent issue key here
def parentLink = customFieldManager.getCustomFieldObjectByName("Parent Link")
parentLink.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(parentLink), parentIssue),new DefaultIssueChangeHolder())

The script is not generating errors, the cloned issue is created successfully, however, the parent link field is not populated.

 

Note: Issue Key, is scripted field, containing the issue key of the Epics Parent

The cloned issue type is Epic. 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events