How to send over the Salesforce Account/ Owner Names instead of IDs?

Originally asked by Mathieu Lepoutre on 05 December 2022 (original question)


Instead of sending over the Salesforce IDs, I want to be able to send over the names, behind the IDs.


Answer by Mathieu Lepoutre on 05 December 2022

This is solvable by using the SOQL REST API included in Salesforce.

For example you want to syncronize over the name of the USER id, you would use this code in the outgoing sync of Salesforce:

def the_id_variable = entity.OwnerId

def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+from+User+where+id=%27${the_id_variable}%27")

replica.res = res.records[0].Name

And then in the replica package, the name appears, instead of the ID.

The final step would be to put this value into a field on the incoming sync of the destination side.

If you want to syncronize over the Account name, instead of the User name, please replace the second statement in the code with this one;

def res = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+from+Account+where+id=%27${the_id_variable}%27")



[Failed to download attachment: attachment_58497503_image2022-12-5_19-2-45.png. Error: 404 Client Error: for url: https://community.exalate.com/download/attachments/58497499/image2022-12-5_19-2-45.png?version=1&modificationDate=1670263467183&api=v2]

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