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

Ovidiu Vasilescu August 23, 2016

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

3 votes
Answer accepted
Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 25, 2016

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.

Ovidiu Vasilescu August 26, 2016

Thank you so much, this works!

0 votes
Ovidiu Vasilescu August 24, 2016

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

0 votes
Ovidiu Vasilescu August 23, 2016

Using JIRA 7.1.1 and Script Runner 4.3.5

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

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 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" 

Haddon Fisher
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2017

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"}
0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2016

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

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2016

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events