How to get change logs of custom fields on ticket update in Freshdesk

Hello,
I need to fetch change logs on the ticket update event for custom fields but in the documentation, it is clearly mentioned as a below restriction
The following changes will NOT trigger the onTicketUpdate event.

  • Updates to custom fields

  • Updates to tags
    And also I tried Events Methods here also I’m getting only the default field changes. How I can get custom field change logs both in backend events or Events Methods
    Below are the screenshots for the events method
    cf_update

    default_update

-Soujanya.

1 Like

Hi @soujanya

Hope you are well :slight_smile:

This is one of the restrictions we have when working with Onticketupdate events, before answering your question,

I’d like to clarify that changelog is not available in the event payload for both custom and default fields in the serverless app. the event payload just gives the current ticket payload related to the event and no historic data.

In the frontend app, using the ticket.propertiesUpdated event, the difference in value can be obtained from the previous and the current value for only the default fields(this will not give a historical changelog, but only a difference between the current and the previous values). and in the case of the custom field, a boolean whether the custom field is changed or not can be obtained from the ticket.propertiesUpdated event.

Setting the restrictions aside, there are few workarounds we can try to overcome this problem,

Approach 1 :

  1. Use the ticket data method, fetch the details of the current ticket on the app’s initial load(app.activated event) and save it in either browser’s local storage or the developer platform’s data storage.

  2. make the changes in the property, including the custom field, and click update, this will trigger the ticket.propertiesUpdated event, inside the handler that handles the event, Check if the custom field is updated, by checking the presence of isCustomFieldsChanged attribute

  3. If the isCustomFieldsChanged is present, use the data method again, to get the current value of the ticket.

  4. compare the custom field between both the saved value during the app load and the current value, send the difference, or the whole value to the backend/serverless app using an SMI call, and carry on with the rest of the execution in the serverless app.

Approach 2:-

  1. make the changes in the property, including the custom field, and click update, this will trigger the ticket.propertiesUpdated event, inside the handler that handles the event Check if the custom field is updated, by checking the presence of isCustomFieldsChanged attribute

  2. If the isCustomFieldsChanged is present, use the data method to get the current ticket ID and send only the ticket ID to the serverless app.

  3. From the serverless app, using the ticket ID that you received from the frontend app through SMI, make an API call to get all the ticket fields including the changes in the custom field.

Hope this helps!

Stay Safe :slight_smile:

4 Likes

Hi @velmurugan
Thanks for your help. I hope this will work for me.

-Soujanya.

1 Like