We have a JSM ticket in which when it is transition to an In Progress status - automation creates a new ticket in our Business Project and we copy over certain fields. If the JSM has subtasks - I want to also copy those subtasks to the Business project. I got stuck on how to handle that after I have the IF statement that subtasks are present. TIA for help!
Based on your scenario, I have a few suggestions to improve your rule...
First, when you add the link to Most Recently Created Work Item, that connects it to the trigger one. But, the second link action is not needed as it will try to link the trigger work item to itself!
Next, the condition to check for the sub-tasks is not necessary. Instead, you may just branch to them and when there are none they will not process. For safety, we can still include it.
Finally, when copying / cloning the subtasks, you will need the new work item's key to set as its parent. That may be saved with the Create Variable action
Putting those ideas together, perhaps try this rule structure:
That approach should work for company-managed projects. When your copying-to project is team-managed, you may need to instead use the REST API to create the work items due to the type differences.
Kind regards,
Bill
Automation can be quite tricky and hard to maintain when it comes to cloning issues from one project to another along with all the subtasks. It will probably require multiple rules to achieve a satisfying result or at least a rather complex workflow.
As an alternative to both facilitate and automate this workflow, you can try our app Elements Copy & Sync. One configuration does it all: cloning from JSM to Jira, setting the fields to copy and cloning all the subtasks.
It only takes a few minutes to set upa nd you can even trigger the cloning on a status change.
Don't hesitate to give it a try, the app is free for 30 days.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bill’s accepted answer already nails the “native Automation for Jira” approach: create the parent in the Business project, store {{createdIssue.key}} in a variable, then Branch rule / related items → Sub-tasks and create each sub-task with Parent set to that variable. That’s the cleanest way if you only need a handful of fields copied.
If you’re looking for something that’s easier to maintain (and usually more complete), you can also solve this with our app Deep Clone for Jira.
Why it helps in your scenario:
You can use a Deep Clone Post Function Clone for your use case and don't need to use any Automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.