I'm trying to create a new ticket in desk when a new lead is created in the "Leads" module using a custom function in Workflow. I'm using the Desk API and postURL function to do this, but keep getting the following error message:
- {
- "responseText":
- {
- "errorCode": "UNSUPPORTED_MEDIA_TYPE",
- "message": "The given content type is not supported. Please provide the input Content-Type as application/json"
- },
- "responseCode": 415
- }
And here is my code:
- lead = zoho.crm.v1.getRecordById("Leads", leadID);
- company = lead.get("Company");
- leadName = lead.get("Lead Name");
- email = lead.get("Email");
- phone = lead.get("Phone");
- interestedIn = lead.get("Interested In");
- eventName = lead.get("Event Name");
- checkInDate = lead.get("Check In Date");
- checkOutDate = lead.get("Check Out Date");
- numberRoomsNeeded = lead.get("Number of Rooms Needed");
- roomType = lead.get("Room Type");
- subject = "Reservation Inquiry";
- departmentId = xxxxxx;
- contactId = xxxxxx;
- dataString = "Company: " + company + " Lead Name: " + leadName + " Intersted In: " + interestedIn + " Event Name: " + eventName + " Check In Date: " + checkInDate + " Check Out Date: " + checkOutDate + " Number of Rooms Needed: " + numberRoomsNeeded + " Room Type: " + roomType;
- header = map();
- header.put("Content-Type", "application/json;charset=UTF-8");
- data = {
- "subCategory": "",
- "productId": "",
- "contactId": contactId,
- "subject": subject,
- "customFields": {
- "Event Key": eventName,
- "Contact Name": "Test Test"
- },
- "dueDate": "",
- "departmentId": departmentId,
- "channel": "Web",
- "description": dataString,
- "priority": "Low",
- "classification": "",
- "assigneeId": "",
- "phone": phone,
- "category": "General",
- "email": email,
- "status": "Open"
- };
- resp = postUrl("https://desk.zoho.com/api/v1/tickets?orgId=xxxxxxxx&authtoken=xxxxxxxxxx", data, header, false);
- info resp;
Can anyone tell me why this isn't working? When I use "info data" I get back valid json and am able to use that json with Postman to create the ticket with the API, just not as a custom function in the CRM. Any ideas?
Thank You