Question

Automatically creating a copy of an incident

  • 26 July 2022
  • 7 replies
  • 70 views

Badge

Hi,

We are trying to automatically create a copy of an incident for another group to use for their own work and records. The standard workflow automater and scenario automations do not appear to have an option to create a copy of an incident. I have dabbled a bit with webhooks to try to trigger the creation of another ticket when one is updated with a specific category, but I am receiving a 400 error.

 

I have put the callback URL as https://(domain).freshservice.com/api/v2/tickets. Encoding is JSON, Simple with just a couple of details to test the process, Inline Credentials, API key appears correct. I can see it activate in the activity of the ticket, but it always returns back failed. 

 

Any tips or other ideas in how I can have a duplicate ticket created and assigned to a group automatically when the ticket is updated?

 

 


7 replies

Userlevel 7
Badge +14

Hello @v.annnps try using “Basic Auth” instead of “API Key”, place your api key in the “Username” field, and a “x” in the password field. See if that works for you.

Take care!

Badge

It didn’t, unfortunately. Any other suggestions? 

Userlevel 7
Badge +14

Can you share with us the fields that you are passing in the body of the request? There are some mandatory fields that are required to create a freshservice ticket via the Freshservice API, just need to make sure we are hitting those requirements. Also I would try this in a tool like Postman to make sure you can successfully generate tickets via the API before using the workflow automator.

Let us know if you need any help with that process.

Badge

So, I’ll be honest I’m a bit of a beginner at this.

Our goal is to have a copy of an incident created when we update the agent category to a specific one. 

I have the workflow automator set up so that when a ticket is updated to the specific category then the event should happen. 

I’m stuck now on whether I should be using a Web Request or Triggering a Webhook?

Initially I was using a WebHook and after filling out the info used the Simple options to select the required fields. After it wasn’t working I even tried “All fields” and “All visible fields” but both returned a 400 error.

I also tried the advanced options to write a script following the info at https://support.freshdesk.com/en/support/solutions/articles/50000002311-create-a-new-child-ticket-automatically-using-a-webhook, though I know that’s mainly for freshdesk.

Finally I tried a WebRequest, first creating a GET request which appeared to be successful? But the POST request isn’t. I was using:

{
         "description": "Child ticket for {{ticket.id}}",
         "subject": "Child Ticket for {{ticket.id}}",
          "email": "{{ticket.from_email}}" ,
          "parent_id": {{ticket.id_numeric}},
          "requester_id": {{ticket.requester.id}}
          "phone": {{ticket.requester.phone}}
          "priority": 1,
          "status": 2,
          "source" :1
}

Definitely a little out of my wheelhouse, so if you have any resources that would be useful for beginners too, I would appreciate it!

Userlevel 6
Badge +10

Hello, 

 

When you use the webrequest node and run the test. what is the the error? 
Do you have any mandatory fields ? 

Badge

The error I receive:

{
  "description": "Validation failed",
  "errors": [
    {
      "field": "description",
      "message": "It should be of type String",
      "code": "missing_field"
    },
    {
      "field": "status",
      "message": "It should be one of these values: '2,7,8,9,12,5,6,10,3,4'",
      "code": "missing_field"
    },
    {
      "field": "subject",
      "message": "It should be of type String",
      "code": "missing_field"
    },
    {
      "field": "priority",
      "message": "It should be one of these values: '1,2,3,4'",
      "code": "missing_field"
    },
    {
      "field": "requester_id",
      "message": "One of the following is mandatory: requester_id, phone, email",
      "code": "missing_field"
    }
  ]
}

 

Our only mandatory fields are Requestor, Status, Source, Priority, Subject, and Description. 

Userlevel 6
Badge +10

Hello, 

 

Is that was the body you sent you are missing a comma after    "requester_id": {{ticket.requester.id}}
But then you should have received incorrect JSON. 

Reply