Freshservice timer events is not working as expected

When I tested the sample app in the dev mode, the timer is added but the flow enters into the catch method and it returns undefined.

client.interface.trigger("start", {id: "timer", value: {agent: 8004638272, billable: true, note: "Sample note"}}).then(function(data) {
    console.log(data)
}).catch(function(error) {
    console.log(error)  // returns undefined
}); 

And also the timer update event returns invalid values

let updateCallback = function (event) {
     console.log(event.type + " event occurred");
     let data = event.helper.getData()
     console.log(data.time_entry.timespent) // returns invalid values
};
client.events.on("ticket.updateTimer", updateCallback);

Any suggestions or am I missing something?

Hi @Bene_Immanuel,

The first issue is a known issue that the interface works fine but enters into the catch block. The product team is yet to fix it. We will let you know when he hears back from the product team after fixing it. Please do not handle the error and do necessary action in both the success and error blocks.

For the second issue, do you report that it doesn’t have any value or has a different value than the added time? Because I’m able to see the value in the timespent attribute of the data.

Hi @Raviraj,

First issue:
OK got it. But, after fixing that issue will that trigger the timer events like ticket.startTimer like in Freshdesk?

You know, in Freshdesk if we start the timer using the data method the ticket.startTimer event will also be triggered will that be the same for Freshservice or will you add a flag to differentiate the origination (manual / data-methods)?

It would be fantastic if you added a flag to differentiate the origination. Please consider this.

Second issue:
Yes, that object has value but it returns the wrong data.

If I stopped the timer after 10 seconds, the value returned is like 19, 59 or something like that.

Essentially what I’m trying to say is that the value is returned but it is not correct.

@Bene_Immanuel For the first issue, it doesn’t trigger the ticket.startTimer event with the Interface method for me. Could you check how does it work for you and report if it’s different behavior?

For the second issue, I’m able to reproduce the issue. I will report it to the product team. But, we cannot provide a timeline when it will be fixed. So, find any alternatives if available.

One of the ways I could find is, making an API to “View a Time Entry” API and get the value of the timespent field if that has a proper value.

Hi @Raviraj,

Thanks for the follow-up!

OK, we will ignore the then and catch blocks for the Start event.

But for the second issue, we are trying to avoid the API limit error so, please let us know once you have fixed the issue in the timer update event.

Hi @Bene_Immanuel,

Regarding the second issue on timespent attribute invalid value issue, the product team has confirmed that it’s the expected working and not a bug.

There is a conversion in the payload for time spent, 60 minutes is converted to 1.

Examples for other durations:

  1. If the time spent is 1 hour, the payload value will be 1.00

  2. If the time spent is 30 minutes, the payload value is 0.50

  3. If the time spent is 10 minutes, the payload value is 0.17

Let me know if this conversion is not clear. I will get this information added to the documentation as well.

Hi @Raviraj,

Thanks for the clarification.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.