Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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.

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 {it.name == 'Epic Link'}
issue.setCustomFieldValue(epicLink, null)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Bitbucket Smart Commits vs. Genius Commits - What's the difference?

If you already heard about Smart Commits in Bitbucket, know that you just stumbled upon something even better (and smarter!): Genius Commits by Better DevOps Automation for Jira Data Center (+ Server...

106 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you