Solved 3CX -> Freshdesk, Freshdesk has custom fields

Status
Not open for further replies.

Owen Last

Forum User
Joined
Nov 8, 2017
Messages
40
Reaction score
6
Hi, hoping someone can help!

We're not particularly (in my opinion!) doing anything that fancy with Freshdesk, we do however have a custom field which is stopping the integration from 3CX from working, as in the log I get the below response;

HTTPStatusCode=BadRequest - Reason=Bad Request - Content={"description":[{"field":"custom_fields.cf_category","message":"It should be one of these values:

So I think "Ok, I need to add a new custom parameter and map it against the POST request", which I do, however now I get this response

HTTPStatusCode=BadRequest - Reason=Bad Request - Content={"description":"Validation failed","errors":[{"field":"custom_fields.cf_category","message":"Unexpected/invalid field in request","code":"invalid_field"}]}

And now I'm stuck, as the field needs to be mapped in order for the ticket to be created; has anyone else managed to add custom fields to their template and get it working?

any help is much appreciated, thank you!
 
to add to this, Freshdesk's API documentation says you need to declare it's a custom field then put the relevant field / string, but how would I do this on the XML?

Normal field
"subject":"Support Required",

Custom field
"custom_fields":{
"gadget":"Plasma Cutter"
},
 
Are you editing the XML template we provide for the integration? The change you need to make will depend on the field you need to send. If it's a plain key-value pair or a nested object as you explained in your previous post. In order to help with this, I would need that you tell me exactly the JSON data that you need to send to the Freshdesk REST API in order to create the ticket. Once you know this I can tell you how to adjust the XML to achieve that.
 
Hi Ernesto,

That's right, I'm updating the XML template you provide in the integration; I thought it would be a plain key-value pair as it looks like that's the response error I get in the log, but just looking on dev docs for Freshdesk it looks different, but I've reached out to Freshdesk for support so hopefully they can confirm.

In the XML template therefore, how would I write it so it would output like the below in JSON?

1639654536794.png
 
This is how the CreateTicketForCall scenario should look like:
XML:
    <Scenario Id="CreateTicketForCall">
      <Request SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;"
                       Url="https://[Domain].freshdesk.com/api/v2/tickets" RequestType="Post" RequestEncoding="Json" ResponseType="Json" >
        <PostValues>
          <Value Key="requester_id" Type="Integer">[EntityId]</Value>
          <Value Key="responder_id" Type="Integer" If="[AgentId]!=&quot;&quot;">[AgentId]</Value>
          <Value Key="phone">[Number]</Value>
          <Value Key="subject" Passes="2">[[Subject]]</Value>
          <Value Key="type" Passes="2">[[TicketType]]</Value>
          <Value Key="status" Type="Integer">2</Value>
          <Value Key="priority" Type="Integer">1</Value>
          <Value Key="description" Passes="2" If="[CallType]==Inbound">[[InboundCallText]]</Value>
          <Value Key="description" Passes="2" If="[CallType]==Missed">[[MissedCallText]]</Value>
          <Value Key="description" Passes="2" If="[CallType]==Outbound">[[OutboundCallText]]</Value>
          <Value Key="description" Passes="2" If="[CallType]==Notanswered">[[NotAnsweredOutboundCallText]]</Value>
          <Value Key="source" Type="Integer">3</Value>
          <Array Key="tags">
             <Value>[CallType]</Value>
             <Value>Call</Value>
             <Value>[Agent]</Value>
          </Array>
          <Object Key="custom_fields">
             <Value Key="gadget">Plasma Cutter</Value>
          </Object>
        </PostValues>
      </Request>
    </Scenario>
 
that is perfect! worked exactly as expected - issue was on the response I was getting custom_fields.cf_category so I added in a value, not an object.

that's great, thank you so much for your help!
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,842
Messages
589,320
Members
164,677
Latest member
skander