How to match the key name of custom dropdown which is from "on ticket update" payload

Hi Team,

Hope you all are doing well,

I triggering a mail while “onTicketUpdate” event based on some conditions.

I getting all ticket fields values on installation page . if user choose ticket status is open and country(here country is custom drop down)is india. I check these values on “onTicketUpdate” event for a particular ticket. If this condition is true i will trigger a mail to agent.

Here i’m facing issue while matching a key name of custom drop down which is getting from “onTicketUpdate” payload. because custom dropdown name from payload look like this
**cf_dropdown_name_(some digits of numbers )**.I don’t have idea about these numbers because if i make api request to view a ticket field api. i’m getting payload for custom drop down like this

In this payload value for a name attribute like cf_country not **cf_dropdown_name_(some digits of numbers )**so i don’t have any idea about that numbers. so kindly help me to solve this issue .

Thank you

Hi @Kithiyon

The numbers appended at the end of custom_fields probably is the AccountId when you receive the payload from onTicketUpdate Event.

You can alter the custom field by removing the account ID along with the “_” , so as to match with that of the name you are receiving from an API response.

Regards,
Jayanth

Thank you @Jayanth_Kumar

I little confused to match the key because if i get cf_name_number from view a field api payload i will remove the numbers with “_” but i’m getting onTicketUpdate payload like cf_name_numbers so how i remove numbers and match the name value of this api payload with onTicketUpdate payload key.

in my code i tryed to get custom field value like this

let customFieldValue = args["data"]["ticket"]["custom_fields"]["cf_region_numbers"]

This payload from custom field

This from onTicketUpdate payload

Hi @Kithiyon , As we discussed on the call, you can make use of the account_id parameter available in the onTicketUpdate event payload and match the ticketField name.Hope the issue is solved.

Regards,
Jayanth

2 Likes

Thank you @Jayanth_Kumar

now i’m able to mach with custom dropdown key from onTicketUpdate event. Thanks for your valuable time.

1 Like

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