Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Script Runner's Create Subtask post-funciton is adding the epic from parent!?

Hi @Jamie Echlin [Adaptavist],  

Using your script runner plugin, I have a transition that simply creates a couple of sub-tasks and it works perfectly. However, if the parent issue is in an Epic the sub-tasks are created and added to the Epic. As you know a sub-task cannot be assigned to an Epic under normal usage.  I have no script or post-funtion to do this and have even tried adding a postfunction on the sub-tasks create transition to clear the "Epic-Link" field however that does not work.  Do you have any ideas on how I can prevent this from happening?  

Thanks in advance

2 answers

1 accepted

2 votes
Answer accepted

Hi John,

You will need to provide the following code to the "Additional issue actions" field in the configuration of the Create a Sub-task post-function. 

checkLink = {link -> false};

By doing that, new sub-tasks of the stories that belong to an Epic will not be listed under the "Issues in Epic" section of that Epic.

You can take a look at the following documentation to get more information about what checkLink is doing:

Thanks! works as expected now.

It doesnt work for me. The subtask continue to show up under Epic and its creating a mess. Any help?

Gautam, can you give some info about the versions of Jira and ScriptRunner your instance is running?

Thanks for responding. My JIRA version is v6.2 and Scriptrunner instance is 2.1.17

Just an update for those finding their way here: see my answer at You can set/clear the Epic Link just like any other custom field in the Additional Actions, along with controlling link copying behavior separately.

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

That didn't work for me. I am using JIRA 6.2, Script runner - 3.0.16. Neither the subtasks are created with the "Epic Link" set to null , nor the epic stops listing the subtasks under the story. 

Ah, yeah, I should have paid closer attention to the version numbers. All bets are off with older unsupported versions of ScriptRunner & JIRA. A lot of those post-functions were rewritten to make use of deeper JIRA validation services to prevent this sort of misbehaviour.

Hi all,

I have the exact same issue and when I try to add "checkLink = {link -> false};" on my script runner code it is giving an error on the "-" saying " Expecting '}', found '-' "

My current little code just validates one field and create sub-tasks if that specific field is with the correct value.


Any ideas? Version:5.3.26

I just crashed into the same problem :(

Hi, @Graciela Persch Severo  @Derek Sheeman 

Same here the syntax didn't work for me, but the following worked

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

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events