Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

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

 
2
1
0

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








    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      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")
      
      



        CommentAdd your comment...