Automatic ticket creation for task list item (beta)

To have a task automatically create a ticket when it's added to the ticket, first you will need to turn this feature on by clicking on the tasks admin icon on the left of the screen. Then switch it on under 'settings' like this:

SweetHawk__-_Agent.png

Important: please click Save settings to commit any changed settings.

Next... to define the details of the ticket you want to create, under the 'Task lists' tab, go into the desired list, then click the 'edit' button next to the task you want.

SweetHawk__-_Agent_2.png

Finally, in the popup screen, in the 'ticket data' section, you will need to provide some JSON that defines the details of the ticket to be created like this:

SweetHawk__-_Agent_3.png

To have a ticket automatically created, you can start by defining a minimal JSON structure in the Ticket data field:

{}

This will create a ticket with default values: the subject will be set to the task list item's name, the description will be just '.' and created as Internal Note.

If you'd like to set other fields, this can be done like this:

{
  "subject": "Printer fire",
  "priority": "high",
  "comment": {
    "body": "Some smoke is coming out!",
    "public": true
  }
}

You can use liquid markup inside the values to copy values from the parent ticket:

{
  "requester_id": "{{ticket.requester.id}}",
  "comment": {
    "body": "Get back to {{ticket.requester.email}} regarding {{ticket.subject}}",
    "public": false
  }
}

You can set custom fields like this:

{
  "subject": "Printer fire",
  "custom_fields": [
    { "id": 12345678, "value": "custom_field_value" },
    { "id": 12345679, "value": "Here's a value" },
    { "id": 12345680, "value": "{{ticket.ticket_field_12345680}}" }
  ]
}

Or set the form and subject to match the parent ticket like this: 

{
  "subject": "{{ticket.title}}",
  "ticket_form_id": "{{ticket.ticket_form_id}}"
}

Because the JSON used is identical to the format Zendesk uses to create tickets, more information about the fields you can use can be found in Zendesk's API documentation.

 

Have more questions? Submit a request

6 Comments

  • 0
    Avatar

    How i can create newline in comments body?

    something like: "body": "Get back to {{ticket.requester.email}} <br/> regarding {{ticket.subject}}"

     

  • 0
    Avatar

    For newlines, please use "\n" (backslash N) so in your example: "body": "Get back to {{ticket.requester.email}}\nregarding {{ticket.subject}}"

  • 0
    Avatar

    Is it also possible to take the attachments of the parent ticket over in the child tickets?

     

  • 0
    Avatar

    Hi Thomas, currently it isn't possible to replicate the attachments over in the children tickets. I think the key thing to for us to get right if we were able to build this functionality is being able to specify attachments to be copied since often there are many superfluous attachments that are just noise. Copying all of those attachments to many tickets would simply amplify the noise. 

  • 0
    Avatar

    Can you leave comments in the code? I have several fields I am putting in with custom data fields and I would like to note which custom field is on each line. Is there a leading character that indicates comments like -- or // ?

  • 0
    Avatar

    Hi George, you can't technically use comments in JSON but you can use this trick to add meta information for your own purposes:

    {
      "custom_fields": [
        { "id": 12345680, "value": "{{ticket.ticket_field_12345680}}", "field_name": "My custom date field" }
      ]
    }

    By using another node like "field_name" you can effectively add comments, as any JSON fields other than the documented ones will be preserved but ignored.

Please sign in to leave a comment.
Powered by Zendesk