Recent searches
No recent searches
JSON webhook to copy a ticket
Posted Aug 24, 2022
I created a Webhook with a JSON body that creates a ticket by copying some values from the original ticket.
This is the code:
{
"ticket": {
"status": "open",
"group_id": 24993349,
"requester_id": 947291444,
"tags": ["{{ticket.tags}}", "ticket_clone_task"],
"subject": "{{ticket.title}}",
"custom_fields": [{"id": 23079830, "value": "{{ticket.ticket_field_23079830}}"}],
"comment": {"body": "{{ticket.comments_formatted}}"}
}
}
However, I need to copy ALL the CUSTOM FIELDS from the original ticket.
In the community I found how to individually copy the custom fields with this line of code:
"custom_fields": [{"id": 23079830, "value": "{{ticket.ticket_field_23079830}}"}],
My question is: Is there a way that copies all the custom fields? Or do I have to insert all the individual custom fields?
Thank you for your help.
0
2 comments
Serge BERTAINA DUBOIS
Bad news Lucas...
I also tried to do this, but couldn't find anything.
I must therefore, like you, write the json for each field.
And if creation or deletion of a field, an update is necessary...
I have a target to test when I have more time:
Create a script (Python for me) which regularly lists (daily for example) all the custom fields and updates the trigger or the automation concerned.
A fun little workshop 😉
Friendships,
Serge.
1
Luca Baldini
Thank you very much Serge!
0