Clone issue Post Function - clearing the Epic Link field for cloned issues

This is pretty much the exact question here:

The problem is that the answer given there is wrong, as is mentioned by the initial poster.

checkLink = {link -> false}  does NOT clear the Epic Link and I see no info in the documentation on how to do this. Googling it I only find the above question over and over again.

Note: I very much like the fact that the command above does not clear the Epic Link; it's good to separate all links from Epic Links. However, I'd like to know what I need to do to specifically clear just the Epic Link.


Any help please?

6 answers

1 accepted

3 votes
Accepted answer

As discussed, the Epic Link is actually its own separate custom field, distinct from regular links. As such, you'll need to clear it separately from the checkLinks closure. You can do both (set checkLink and clear the Epic Link), or just do the one that suits you in the Additional Actions section of a post function. To clear it, just set the value to null.

checkLink = {link -> false};
def epic = customFieldManager.getCustomFieldObjects(issue).find { == 'Epic Link'}
issue.setCustomFieldValue(epic, null)

Take note that your mileage may vary on accessing the Epic Link through the custom field manager, depending on what version of JIRA and ScriptRunner you're using. I tested the above on JIRA 7.

Thank you so much, this works!

0 votes
Tarun Sapra Community Champion Aug 23, 2016
0 votes
Tarun Sapra Community Champion Aug 23, 2016

What's the JIRA and ScriptRunner Version that you are using?

0 votes
Tarun Sapra Community Champion Aug 23, 2016

or can you try to explicitly try mentioning "Epic LInk" in the additional condition section like in example - checkLink = {link -> != "Cloners"} , so instead of cloners you can mention "Epic Link" 

I was able to clear the epic link field when auto-creating sub-tasks by adding the following:


checkLink = {link -> != "Epic-Story Link"}

Using JIRA 7.1.1 and Script Runner 4.3.5

I'll try your solution when I get to work tomorrow.

Yeah it's giving me an error. Also, I think if checkLink would work for Epic Links, it would work with the blanket link -> false so I doubt this will lead us anywhere.


image2016-8-24 14:12:48.png

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

244 views 6 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