Can't set epic link in a script

Hi there,

I have a manager who wants to have a transition on epics for the purpose of creating a set of stories.

I can create his list of issues and set various custom fields for him in a pastfunction, but nothing I do sets the Epic link.

I have tried by issue ID and key, and also tried using a text custom field I created to hold the issue key value.

Issue issue  = issue def id=sourceIssue.key
// Get the Epic Link field
CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link')
// Create the issue
issue.summary = 'Create tenant for ' + sourceIssue.key
checkAttachment = {attachment -> false}
issue.assignee = null


I also can't seem to import any greenhopper methods nor call the epicLinkManagerImpl as a bean.

Is there any way to do this in JIRA 7.1 with the latest ScriptRunner, or would it help in any way to upgrade Jira? Maybe I could sacrifice a goat or something?

Thanks in advance for all your help!

3 answers

1 accepted

1 vote
Answer accepted

If I remember correctly, you should store issue object for epic link field. Like:


Why doesn't this work for me?

(is the issue type wrong?)

I get

2017-03-10 11:31:56,640 WARN [common.UserScriptEndpoint]: Script console script failed: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.DocumentIssueImpl.setCustomFieldValue() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl, null) values: [PMOA-40, null] Possible solutions: getCustomFieldValue(com.atlassian.jira.issue.fields.CustomField) at Script1636$_run_closure1.doCall(Script1636.groovy:42) at

Yup, just test checkLink = {link -> false} in the subtasks, and that fixed it up just fine.

Thanks again for the save smile

And clear the epic link. Thus:

checkLink = {link -> false}
def epic = customFieldManager.getCustomFieldObjects(issue).find { == 'Epic Link'}
issue.setCustomFieldValue(epic, null)
Strange that you need both.. JIRA keeps suprising me every day..


Why am I getting (with the code above)



No signature of method: com.atlassian.jira.issue.DocumentIssueImpl.setCustomFieldValue() is applicable for argument types: (com.atlassian.jira.issue.fields.ImmutableCustomField, null) values: [Epic Link, null] Possible solutions: getCustomFieldValue(com.atlassian.jira.issue.fields.CustomField)

which version of JIRA do you have?

We are on 7.2.7 Server, with ScriptRunner latest

You need the MutableIssue interface. If you use this method from a ScriptRunner workflow function, the issue is already of type MutableIssue. If you write your own groovy script, you have to use com.atlassian.jira.issue.MutableIssue.

Like 1 person likes this

I think this all depends on exactly where you run the statements.

I am using them as a condition with the built-in post function to create a sub-task.Works fine.

It looks like other folks in the thread may be trying these lines in the console or perhaps a custom script, so of course this will behave differently, as the imports and variable declarations in the built-in script will not be present in the console.

Like 1 person likes this

Holy cow IT WORKS!!!!

Alexey, you are awesome smile

The only bad thing that happened is that on the Training issue type, which creates a set of subtasks on creation, it copied the Epic link to those.

Do you think I could get rid of that with checkLink = {link -> false}, or is that fallout from that recent bug I think I recall seeing?

Epic Link is different from usual issue links, you should set value of this field to null in cloned issue.

More here

Ah, I see what you mean. I bet this only seemed to work because of the subtask issue type.

For safety, I've also added:

//Kill the little b*tard 
def epic = customFieldManager.getCustomFieldObjects(issue).find { == 'Epic Link'} 
issue.setCustomFieldValue(epic, null)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


242 views 0 6
Read article

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