Sometimes you will want the parent ticket to display comments from all of the child tickets to avoid toggling to the children tickets. To set this up, we'll need to use the update-parent-ticket action of our webhook and a trigger.
With update-parent-ticket action, you can update any data on the parent ticket - comments, status, custom fields, or anything else!
To set up the trigger that updates the comments, navigate to the Admin Center > Objects and rules > Triggers > Add new trigger:
Conditions:
- Ticket is - Updated
- Tags contains - at least one of the following - mpm_child_ticket
- Comment - Present (public or private)
Actions:
- Notify active webhook - MPM Webhook
- JSON Body:
{
"action": "update-parent-ticket",
"data": {
"ticket": {
"comment": {
"body": "Child Ticket {{ticket.id}} Comment by {% for comment in ticket.comments limit:1 offset:0 %}{{comment.author.name}}: {{comment.value}}{% endfor %}",
"public": false
}
}
}
}
The parent ticket now will be updated every time a child ticket gets a new comment. The comment will display in the parent ticket like so: "Child Ticket 937 Comment by Frank: This is a comment from child".
Feel free to change the trigger conditions and JSON body to match your display requirements.
If you want to include the attachments you can use the following JSON Body:
{
"action": "update-parent-ticket",
"data": {
"ticket": {
"comment": {
"body": "{% for comment in ticket.comments limit:1 offset:0 %} Child Ticket #{{ticket.id}} Comment by [{{comment.author.name}}](/agent/users/{{comment.author.id}})\n \n {{comment.value}} {% if comment.attachments.size > 0 %}\n \n Attachments \n \n {% for attachment in comment.attachments %} [{{attachment.filename}}]({{attachment.url}})\n{% endfor %}{% endif %}{% endfor %}",
"public": false
}
}
}
}