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

1 answer

1 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:

https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Controlofcloninglinks

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 https://answers.atlassian.com/questions/40003636. 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 {it.name == '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.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
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