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

This is pretty much the exact question here: https://answers.atlassian.com/questions/18812102

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

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 {it.name == '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 vote
Tarun Sapra Community Champion Aug 23, 2016

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

0 vote
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 -> link.issueLinkType.name != "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 -> link.issueLinkType.name != "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 Join to answer
Community showcase
Emilee Spencer
Published Friday in Marketplace Apps

Marketplace Spotlight: DeepAffects

Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...

56 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot