Auto Clone a task as a subtask in another project when you link to the Parent in the other project
Asked by Karen Kelly:

I have a project where we import trades from a spreadsheet every day as standard Task tickets in ARBBLOTTER.

Instead of going into our POSKEEPER project and creating BUY and SELL subtasks linking to the relevant tickets in the first project under the relevant Parent tasks I want to automate this process.

I see that you cannot move tickets between projects with automation so if I was able to clone them and select the correct parent task to create these subtasks in that would be good, but there is no 'Destination Issue' option in the 'Parent Issue' drop-down only 'Current issue' and 'Trigger Issue'.

![Screenshot 2023-02-15 at 10.20.15.png](/t5/image/serverpage/image-id/240262i746FA307AA92711E/image-size/large?v=v2&px=999 "Screenshot 2023-02-15 at 10.20.15.png")

I found this solution that got me there half way, but not quite: <https://community.atlassian.com/t5/Jira-Core-Server-questions/Jira-automation-convert-a-task-to-a-sub-task-and-link-it-to-a/qaq-p/1294818>


Answers:
author: Trudy Claspill
body: Hello [@Karen Kelly](/t5/user/viewprofilepage/user-id/1396766)

You should be able to simply type into that field to add a smart value reference.

![Screen Shot 2023-02-15 at 11.56.28 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/240427i73FAC188951FF947/image-size/large?v=v2&px=999 "Screen Shot 2023-02-15 at 11.56.28 AM.png")

After typing in the entire smart value you need to click on the "Smart value ..." text displayed below the field to actually insert the smart value into the field.

![Screen Shot 2023-02-15 at 11.58.24 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/240431iF1496007D2DC48E9/image-size/large?v=v2&px=999 "Screen Shot 2023-02-15 at 11.58.24 AM.png")

comments: author: Karen Kelly
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) Thank you so much! This is working beautifully. Just finding another glitch... Seems like when you clone the issue the fields linked to Asset Attributes loses their values.

I have 3 fields linked to Assets and only 1 of them seems to update when I use the following code using my correct Application ID, how do I get field 2 and 3 to update in the same way?

{  
"fields": {  
"customfield_10923": \[{ "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:{{issue.parent.customfield_10923.get(0).id}}"  
}\]  
}  
}

Then also, the issue link is now to the Parent that I originally linked, how can I write automation to copy the link to the newly created subtask and delete the link from the parent task?


author: Trudy Claspill
body: > Then also, the issue link is now to the Parent that I originally linked, how can I write automation to copy the link to the newly created subtask and delete the link from the parent task?

Can you provide sample data/issue keys to illustrate this scenario? I'm a little lost on what you're referring to with the various uses of "link" in that sentence.

The native Assets functionality in Jira is part of the Jira Service Management product. Your post is tagged as a Work Management topic. Are you linking to Assets where that is the native Assets for JSM, or is Assets a custom field/issue type that you have added to your instance?


author: Karen Kelly
body: No problem, e.g. If I link ARBBLOTTER-112 to the parent ticket POSKEEPER-835 it creates a Linked issue link between the 2 and creates a sub task in POSKEEPER-835 but the subtask does not show a linked issue to ARBBLOTTER-112. I just want to show the link on this ticket as well. I am able to get the actual key to display in a text field called Issue Key (TXT) but not in the Linked issue field

![Screenshot 2023-02-22 at 21.31.18.png](https://community.atlassian.com/t5/image/serverpage/image-id/241781i4366E72D815B78C2/image-size/large?v=v2&px=999 "Screenshot 2023-02-22 at 21.31.18.png")


author: Karen Kelly
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) I found the answers! You need to link to the cloned issue after it is created using:

![Screenshot 2023-02-23 at 10.13.34.png](https://community.atlassian.com/t5/image/serverpage/image-id/241870iF0AB4CAB5BE2C18E/image-size/large?v=v2&px=999 "Screenshot 2023-02-23 at 10.13.34.png")

And then I delete the link from the parent issue right at the end using:

![Screenshot 2023-02-23 at 10.13.34.png](https://community.atlassian.com/t5/image/serverpage/image-id/241871iC1A8DCBDBF28C7D4/image-size/large?v=v2&px=999 "Screenshot 2023-02-23 at 10.13.34.png")

I also managed to get all the asset linked field values to come across using Json, so everything works now


author: John Funk
body: Hi Karen,

I don't think I am completely following you. Can you give a step by step of what is happening and what you want it to do?


Tags: cloud

jira-work-management-cloud