Automation to clone an issue into a different project and create a subtask in the cloned issue
Asked by Andrew Kwong:

Hi all, I'm trying to build an automation.

Intent: When I raise a request in my portal, I want it to clone the new issue into a different project. I also want a subtask to be created within the cloned issue based on a certain parameter from the portal request.

Where I need help: I get stuck when trying to make the automation also create a subtask on the cloned issue. I've attached a screenshot of my current automation setup. In the audit log, I'm seeing that a subtask can only be created in the parent project.

I'm hoping that there's a workaround and hope that I'm not skipping any crucial steps. Thanks in advance!![Capture.PNG](/t5/image/serverpage/image-id/268048i8A0742910A5B3AAC/image-size/large?v=v2&px=999 "Capture.PNG")


Answers:
author: Himanshi
body: Hello [@Andrew Kwong](/t5/user/viewprofilepage/user-id/5256750) ,

Welcome to the community!

If I understood your concern correctly you are getting error when subtask is being created :

"a subtask can only be created in the parent project."

Could you please share the exact flow of the request lets say You wish to clone an issue from Project A to Project B then want to create a subtask under the cloned issue(recently created).

For this scenario I have an automation rule setup , sharing the snippet with you please try to tweak your automation rule accordingly:

![Screenshot 2023-07-11 at 10.45.00 PM 1.png](https://community.atlassian.com/t5/image/serverpage/image-id/268167i86BE633B47DD19D3/image-size/large?v=v2&px=999 "Screenshot 2023-07-11 at 10.45.00 PM 1.png")

Hope it would help

comments: author: Trudy Claspill
body: Hello [@Andrew Kwong](/t5/user/viewprofilepage/user-id/5256750) [@Himanshi](/t5/user/viewprofilepage/user-id/5188557)

I was just addressing the same question in another user's post.

Note that to use the automation provided by Himanshi the Automation Rule must be configured as a multiple-project rule with both the source and destination projects listed in the Project Scope. Without that, the branch for **Most recently created issue** will fail like this:

![Screen Shot 2023-07-11 at 1.27.00 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/268203iCBE5277F1D8F7BFD/image-size/large?v=v2&px=999 "Screen Shot 2023-07-11 at 1.27.00 PM.png")

A single project rule cannot operate against issues in other projects except in limited ways. It can Create an issue in another project and Clone an issue to another project, and create links between the current issue and the new issue, but it can't create subtasks under the issue that was created in the other project.

The alternative to making the rule a multi-project rule is to create another rule in the destination project that will create the subtask upon creation of the new issue.


author: Andrew Kwong
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) and [@Himanshi](/t5/user/viewprofilepage/user-id/5188557) - Thank you both for the insight here! Very helpful. I wish that I'd asked the community earlier!


author: Andrew Kwong
body: One more question. So I've gotten the subtask to work. But on the request from project A, if the parameter that would trigger the subtask isn't met, I still want to clone the task.

As in a pass/fail. Fail clones the issue and makes a subtask. Pass just clones the issue. I've added an extra component to account for the "pass" but it doesn't seem to work. Any tips?![Capture 2.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/268209i5D01FDB50FE0FC44/image-size/large?v=v2&px=999 "Capture 2.PNG")


author: Trudy Claspill
body: I am confused about the condition you are trying to apply.

Looking at the rule, the task will only be cloned if the trigger issue field "Did injury..." is set to Yes. Then the issue is cloned and the subtask is created.

Are you saying that if that field is set to No then you still want the issue cloned, but no subtask created?

If so, then move the condition from before the Clone action to after the Clone action (and before the branch). Then the clone is always made but the subtask will be created only when the field is Yes. The rest of the steps you have in the rule after creating the subtask are not needed.

![Screen Shot 2023-07-11 at 2.43.21 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/268211i873212A8154ACC4A/image-size/large?v=v2&px=999 "Screen Shot 2023-07-11 at 2.43.21 PM.png")


author: Andrew Kwong
body: Thank you again!


author: Andrew Kwong
body: Wondering if you can help again on something. I've successfully layered multiple subtasks to be created off of certain parameters in a portal form. Is there a way to make the subtask summaries and descriptions dynamic? As in pull in information from specific fields from within the portal form.


author: Trudy Claspill
body: [@Andrew Kwong](/t5/user/viewprofilepage/user-id/5256750)

That question doesn't seem related to the Automation Rule help you asked for in your post.

If it is a new topic, please start a new Question for it.


Tags: cloud