Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Automatically assigning sub-tasks based on seed issues

I have a workflow which utilizes a custom field. This field has 60 options, each representing a unique dept in the company. The user selects all depts that will be stakeholders in the project. When they transition the issue, a scripted post-function iterates through the depts they selected, and creates a subtask for each one. Example: "Finance"

Meanwhile, I have another project which contains seed issues related to each of these depts, and a specific person assigned to each one. Example: "Finance" assignee = Bob Smith. "Maintenance" assignee = Melissa Brown.

When a stakeholder sub-task is created, it should look to the associated seed issue (using JQL), get the seed assignee, and make them the assignee for the new sub-task. Example: "Finance" dept is selected, so "Finance" sub-task is created. Upon creation, it finds the "Finance" seed issue, gets the assignee (Bob Smith), and sets them as the assignee for the new sub-task.

This way, I can make it so that assignees are handled automatically, based on dept, and they can be easily updated in the seed issues. If the assignee in the seed is changed, the next time a sub-task is created for that dept, the assignee will be the new person.

I have the post-function to update the assignee on the sub-task to match the assignee from the seed issue occurring during the sub-task's Create transition. The trouble I'm having is that it doesn't always work. Sometimes it does, but often the sub-task gets created but the assignee is not updated. I have tried changing the order of the post-functions. I have tried making it part of another separate transition, which is run after the Create transition has completed. I have tried using an event listener to trigger the separate transition. None of them work reliably. It works when I run that transition manually, but not when it's triggered automatically. My last resort will be to created an Escalation Service job which will run the transition on a schedule. I do NOT want to have to do it that way. I really want this to happen immediately, not on a delay.

Any advice? My guess is that the Create transition is not quite complete before it's running the Assignee update, so it's failing to process it. But I haven't found a reliable solution.

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 14, 2022

It sounds like you are doing almost everything right.  Specifically, "post-function on the sub-task create should set the assignee".  

I would actually not do it that way, it's the second-best option.  I would put the "look up who to assign" and set it as the sub-task is created (you are already running code that accepts the issue type and summary as the core things to create the sub-task with, why not throw in assignee there as well?)

To debug this, I think you need to look at patterns.  Are there patterns in the failures such as "Bob always gets assigned correctly, but Charlie never does" or "It fails when it gets run on Tuesday afternoons"?

Also, we don't know exactly what is failing.  There's two steps in this process, not one.  Do we know if it is failing to find the assignee to try to use, or if it's finding one and failing to put it into the issue?

Could you add logging to your code, just something simple that says "output an easily searchable string plus the name of the person I found to try to assign to"?  

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events