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

This widget could not be displayed.

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!

This widget could not be displayed.
Tarun Sapra Community Champion Aug 23, 2016
This widget could not be displayed.
Tarun Sapra Community Champion Aug 23, 2016

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

This widget could not be displayed.
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"}
This widget could not be displayed.

Using JIRA 7.1.1 and Script Runner 4.3.5

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

This widget could not be displayed.

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
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 yesterday 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...

81 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