Further questions towards "onTicketUpdate" Behavior

Hello,

An issue that we dealt with last year was the impact that workflows had on the “onTicketUpdate” event. Here is the thread that mentions the issue.

My question is that @Saif mentioned that each of these events when triggered produce a unique ID. Is it possible then to access that ID in some sort of payload information and then prevent the serverless event from being triggered based on that ID?

For example, lets say that the workflow automator is given the unique ID of “WA-0” for all update events on a ticket triggered by a workflow. I would want to write an IF statement that says if the triggered event returns the above workflow ID, then don’t execute the remaining code (in my application, a Chat Notification).

Does this seem feasible and something that we could do with this platform?

Thank you for the suggestions. And big shout out to @Saif for diving into this over the course of last year. Hopefully we can finalize a solution.

Take care,

Zach

@Zach

That should be possible to do. But I noticed that apps don’t get the needed attribute in the payload received to the onTicketUpdate event callback. I am working with App platform team to have that attributed get appended in the payload so that developers can do a simple if condition.

2 Likes

Posting an update, although not a solution yet.

App Platform team has heard from Freshservice team that this attribute is shared to the platform. It’s now on App Platform to make it available to the developers via onTicketUpdate product event. We are following up with Platform product managers to get an update.

cc: @harish.janjam

2 Likes

@Zach,

Do you mind trying out now and share the payload on this thread? Our team is assuming, this attribute is now appended. Just want to confirm the same. For now, please log the payload from the app deployed in production.

1 Like

@Saif,

I went ahead and ran the application in production. Workflow triggered a ticket update and the therefore the onTicketUpdate event was triggered sending the payload to the serverless logs. Here is a screenshot of its contents

I am not sure where the workflow automator ID triggering the event would be located in this payload information. Nothing jumped out at me unless it is located inside the “Changes” object.

Hope this helps.

-Zach

1 Like

Hey Zach, I just logged the payload (the payload is same for create and update) in our test Freshservice account. It sort of looks like the following

{
   "iparams":{
      "requestbin_url":"https://xxxx.x.pipedream.net"
   },
   "region":"IND",
   "data":{
      "ticket":{
         "subject":"new schedule ticket 190311124705",
         "description":"Description for new schedule 190311124705\n",
         "is_description_html_truncated":false,
         "description_text":"Description for new schedule 190311124705",
         "is_description_text_truncated":false,
         "due_by":"2021-03-04T18:21:04+05:30",
         "fr_due_by":"2021-03-02T18:21:04+05:30",
         "fr_escalated":false,
         "is_escalated":false,
         "fwd_emails":[],
         "reply_cc_emails":null,
         "email_config_id":null,
         "id":2617,
         "group_id":null,
         "group_name":"No Group",
         "department_id":27000004089,
         "department_name":"Operations",
         "responder_id":27000015175,
         "requester_id":27000015176,
         "responder_email":"testme@gmail.com",
         "responder_name":"FSAgent1 Automation",
         "status":2,
         "status_name":"Open",
         "priority":1,
         "priority_name":"Low",
         "type_name":"Incident",
         "tags":[],
         "spam":false,
         "source":2,
         "source_name":"Portal",
         "urgency":1,
         "urgency_name":"Low",
         "impact":1,
         "impact_name":"Low",
         "category":null,
         "sub_category":null,
         "item_category":null,
         "cc_emails":[],
         "created_at":"2021-03-01T18:21:04+05:30",
         "updated_at":"2021-03-01T18:21:04+05:30",
         "attachments":[],
         "problem":null,
         "change":null,
         "assets":[],
         "custom_fields":[]
      },
      "requester":{
         "id":27000015176,
         "name":"FS Requester1",
         "email":"fs.req12@gmail.com",
         "mobile":null,
         "phone":null,
         "language":"en",
         "created_at":"2018-10-12T13:01:22+05:30"
      },
      "actor":{
         "profile_id":27000015176
      }
   },
   "account_id":"xxxxxx",
   "domain":"xxxxx.freshservice.com",
   "event":"onTicketCreate",
   "timestamp":1614603064.994523,
   "app":"prodappeve"
}

Which clearly has the requester and actor objects.

Can you try logging just the $.requester or the $.actor key? Also a tidbit of info, we generally trim the logs to the first 1000 characters. So the best payload logging way is to capture the payloads in a requestbin or any such HTTP bin

1 Like

@prithvi,

So I was able to get those keys in requestbin. They look similar to your payload.

Hope this helps.
-Zach

1 Like

@Zach so the actor key is basically what you were looking for right (a workflow automator ID)? An ID unique to whatever is acting on the payload. Or did I misunderstand the requirement?

@prithvi,

In the this thread @Saif had heard back from the product team that an attribute in the payload had become available that would identify a workflow automator that had been triggered causing a onTicketUpdate event. However, it was never indicated what that attribute was labeled or where it was in the payload. That is what we are trying to locate, in hopes to be able to run conditionals against those workflow automator IDs to prevent whatever function we have built for onTicketUpdate from running unintentionally. In my case, to prevent a notification from being triggered multiple times.

Hope that clarifies things a bit.

-Zach

1 Like