Copy Element Connect Field with JSON in Automation
Asked by Gor Greyan:

Hi Colleagues.  

Please help me with this case.  

I have automation, which opens sub-task. In the main ticket I have Element Connect field, which I want to copy in the sub-task via Additional fields JSON, but I can't.   
Kindly ask you to help with the JSON syntax.  

Thanks in advance.


Answers:
author: Simon Laffont
body: Hello [@Gor Greyan](/t5/user/viewprofilepage/user-id/5476846)

I am part of the Elements Connect support team.

Where is the Automation rule triggered, in the sub-task or in its parent? Can you please share a screenshot to show us how your automation rule is configured?

Kind regards,  
Simon.

comments: author: Gor Greyan
body: ![AUTOMATIOn_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/323579i04856CCB1BF1F23D/image-size/large?v=v2&px=999 "AUTOMATIOn_1.png")


author: Gor Greyan
body: Hi Dear [@Simon Laffont](/t5/user/viewprofilepage/user-id/3728522) ,  
Automation is triggered when the issue goes to Recruitment status, after that sub-task is created with this automation. I want to copy the Element Connect field from the Recruitment task into the created sub-task.


author: Simon Laffont
body: Hi [@Gor Greyan](/t5/user/viewprofilepage/user-id/5476846)

Alright, thank you.

I think [@Zuri Suwru](/t5/user/viewprofilepage/user-id/5158381)'s answer was good, but you should use "**triggerIssue** " instead of "**parentIssue**", like this:

```
{
  "fields": {
    "customfield_20137": {{triggerIssue.customfield_20137.asJsonStringArray}}
  }
}
```

Can you please try it and let me know if it works?

If the problem persists, please tell me the type of the connect field you are using *(Live Text, Live User, Snapshot Text, etc...)* and also if it's single or multi-value.

Kind regards,  
Simon.


author: Gor Greyan
body: Dear [@Simon Laffont](/t5/user/viewprofilepage/user-id/3728522) ,  
It is worked for me.  
Thank you very much for help.


author: Simon Laffont
body: You are welcome.

Have a nice day. :)


author: Zuri Suwru
body: Hey there,

Make sure to copy the custom field's value "asJsonStringArray".

```
"customfield_12345" : {{ issue.customfield_12345.asJsonStringArray }}
```

I would also suggest double checking whether the custom field is properly configured for your sub-tasks or not.

Hope this helps,  
Zuri

comments: author: Gor Greyan
body: Hi [@Zuri Suwru](/t5/user/viewprofilepage/user-id/5158381) ,  
Tried this, but got the following error.  
Error while parsing additional fields. Not valid JSON.


author: Gor Greyan
body: ![JSON.png](https://community.atlassian.com/t5/image/serverpage/image-id/323541i44A52EC63862A162/image-size/large?v=v2&px=999 "JSON.png")


author: Zuri Suwru
body: Pardon me, I though you were interested in the syntax for the specific field in question. I did not think you need a complete JSON code.

Can you try it like this?

```
{
"fields": {
"customfield_20137": "{{parentIssue.customfield_20137.asJsonStringArray}}"
}
}
```


author: Gor Greyan
body: Dear [@Zuri Suwru](/t5/user/viewprofilepage/user-id/5158381) ,  
Tried also this, and automation succeeded, but the field is not being copied.


Tags: data-center

jira-service-management

jira-service-management-data-center

json