Link subtask to parent issue automatically with scriptrunner?

Hi,

 

Has anyone successfully created a subtask on the Create transition and subsequently linked it to its parent issue automatically in the same transition with a script?

 

I'd really appreciate if you'd share how this can be done

 

Thanks,

 

Connor

1 answer

Hello Connor.

I believe this can be done with the SR Create Subtask post function.

Since it is a sub task, it needs to have a parent, so if you were to add this post-function in te onCreate transaction, it would create the subtask that you are looking for.

This is the dialog that you need to fill, and it can be accessed in the add postfunction dialog in the workflow transaction editor.

Screen Shot 2017-07-26 at 10.13.43.pngIf you have more questions do not hessitate to ask.

Cheers!

Dyelamos

 

Dyelamos,

Thank you for the reply! I'm already able to create subtasks through this exact dialog- my question is how I can configure this dialog so that upon creation the subtask will be 'linked' to the parent issue - do you know how I could configure that?

Thanks a lot

Connor

Isn't that done automatically? When I create a subtask it links the parent on its own

That's a good point - a sub-task is always part of its parent and displays as such. The fact it is a sub-task means there is a link to the parent.

Creating an issue link as well is redundant (although if you looked at the code, you'd see an invisible "system" issue link is already there)

I'm running into something similar. There is a brief moment in time after the sub-task is created when it technically isn't linked to the parent. I know this is happening because I have a script listener that burns down the remaining estimate of the parent when the sub-task is created (this keeps the overall remaining estimate accurate up the chain so we're not double-counting, as the Remaining Estimate of the parent includes the Remaining Estimates of its children when using Portfolio).

This functionality works properly at any level above sub-tasks (e.g. when I add an issue to an Epic) when issues are created, but I have to go back into the sub-task and update it in order for the functionality to work properly at this level. This is because the script listener is triggering off of Issue Created, Issue Updated, and Work Logged On Issue events.

Since the listener works properly when the issue is updated and works properly for other issue types, it seems like the subtask and parent aren't actually linked at the time that the Issue Created event fires. I've tried adding post functions that do nothing but sleep for a second or two, but this hasn't had an impact. I've also added a sleep to the beginning of the script listener.

So, does anyone have any idea of how to get the parent/sub-task link to happen more quickly? I've also tried creating a post function that transitions the subtask back to the same status and triggers an Issue Updated event, but this also didn't have an impact.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

139 views 0 3
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