Questions for Confluence license has expired.

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

look up Salesforce name using contact id

 
1
0
-1

Hiya - so when we grab the Case.ContactId it returns the Contact ID key (eg. 003Aq000007PctQIAS) - not the name.  Are we able to use this key to lookup the contacts name in the salesforce object ContactCleanInfo.name using ContactCleanInfo.ContactId = "003Aq000007PctQIAS" and then send this back to Jira in the Salesforce Outgoing script?

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi Dave,


      In the outgoing Salesforce to Jira script, we're using:

      def queryUser = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+FROM+User+WHERE+Id=%27${entity.OwnerId}%27")


      This instruction does a query through the Salesforce API to get detail of a record (User object) based on an Id (here the OwnerId of the Case being synchronized with Jira).


      From that example you may adapt to get details of the Contact.


      Regards,

      Stéphane

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Yep great - thats actually what we did:



        String player_id = entity.ContactId
        String playerName = "Player Not Found"
        
        try {
        playerName = httpClient.get("/services/data/v54.0/query/?q=SELECT+Name+from+Contact+where+id=%27${player_id}%27").records[0].Name
        } catch(Exception e1) {
        //fail silently
        }



        Appreciate the reply - glad we've gone about it the right way!


        Cheers!

          CommentAdd your comment...