Sync Salesforce with Zendesk to retrieve Assets information

Originally asked by Syed Majid Hassan on 11 October 2022 (original question)


Ticket starts off in Zendesk

We populate an Asset serial number in Zendesk

Requirement is to fetch the Install Date of that Asset from Salesforce, in addition to having a case object created.


Answer by Syed Majid Hassan on 11 October 2022

In order to achieve this use case, the following code snippets were added to the standard Exalate code:

Zendesk Outgoing Expand source

replica.customFields."Asset Serial Number" = issue.customFields."Asset Serial Number"

Zendesk Incoming Expand source

issue.customFields."Asset Information".value = replica.SF_variable

Salesforce Outgoing Expand source

replica.SF_variable = entity.SF_variable

Salesforce Incoming Expand source

def res = httpClient.get("/services/data/v36.0/query/?q=SELECT+InstallDate+FROM+Asset+WHERE+SerialNumber+=+'${replica.customFields.'Asset Serial Number'.value}'")
if (res.records.size()>0){
    entity.Client_Mood__c = res.records[0].InstallDate
    syncHelper.syncBackAfterProcessing()
}

A video demonstration of the solution is attached here:

ZD SF Assets sync.mp4 (old community)

Thanks
Majid


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