Set the epic link of an issue created with ScriptRunner clone an issue and links


I am trying to set the Epic link of an issue that is created with the clone an issue and link script from ScriptRunner.

I have the following script in a post-function in the additional actions field:

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

issue.summary = '[SR] ' + sourceIssue.summary

def issueManager = ComponentAccessor.getIssueManager()

def epicIssue = issueManager.getIssueObject('AQ-12249') // Support requests epic
def epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link')
issue.setCustomFieldValue(epicLink, epicIssue)

UserMessageUtil.success("Created issue for development.")

When I run this, I get the following Nullpointer:

Caused by: java.lang.NullPointerException
... 2 filtered
at java.lang.reflect.Method.invoke(
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(
at com.sun.proxy.$Proxy211.createIssueLink(Unknown Source)
... 2 filtered
at java.lang.reflect.Method.invoke(
at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(
at com.sun.proxy.$Proxy211.createIssueLink(Unknown Source)
at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.createLink(
at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.updateLinksForIssues(
at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.associateIssuesWithEpic(
at com.atlassian.greenhopper.service.issuelink.EpicServiceImpl.addIssuesToEpic(
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.associateIssueWithEpic(
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.createValue(
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.createValue(
at com.atlassian.jira.issue.fields.ImmutableCustomField.createValue(
at com.atlassian.jira.workflow.function.issue.IssueCreateFunction.execute(
at com.opensymphony.workflow.AbstractWorkflow.executeFunction(
at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(
at com.opensymphony.workflow.AbstractWorkflow.initialize(
at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(

Any ideas what I am doing wrong here?




1 answer

This widget could not be displayed.

Hi Geert,

You additional script looks fine. So I suppose the issue may is with the clone issue post function configuration. Do you mind to share that configuration ? For example which fields you selected to be copied, etc. 

Also for which step you have set up the post function and in what order ?

Hello Thanos,


Thank you for your reply. Below are screenshots from the clone-and-link configuration and the workflow in which this function is called.

Please note that I disabled the additional issue actions which caused problems, so you do not see them here.




Ok, something else I just noticed: we cannot set this specific epic link for any issue, and when I navigate to the (epic) issue, it shows an error as described here:

So I think the epic issue is somehow corrupted.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 18 hours ago in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

45 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you