2 Replies Latest reply on Apr 17, 2018 4:25 AM by Gabriele Cannas

    ICRT Sample - Get Account Data Using JSON List as Input

    Casey Clayton Seasoned Veteran

      Hi All,

       

      This discussion is in response to a recent question.

       

      How can I create a process to return Account Details, that can accept a list of Salesforce Account ID's as input.

       

      A previous sample I have posted gives a great example where we pass in single criteria, it will only return detail on a single account.  It shows in detail how you can access data in a Salesforce Objects and build up Process Objects as output for Web or File.Sample Process: Salesforce Account, Contact, Case to JSON & XML

       

      Since that sample also had some components that showcase the File Connector, I decided to leave that post be, and create this new one for Web Service output in response to an Object List input.

       

      Because of the XML that is at the core of Process Designer, there are some tricks to take a simple JSON array like this:

       

       

          { "Id":

          [

              "0036100001E2PhK",

              "00161000002zQms",

              "00161000019qodE"

          ]

          }

       

      The key to simplifying this is to use a simple Process Object to help handle the Array input.  I called mine "ObjectId"

       

      Using a single input field, that is an Objects List > Process Objects > List of ObjectId

      And be sure to set "Input field is whole payload" on the "Start" tab.

       

      For good measure this process will show the List Head/Tail method of stepping through one Object List to build up another.  It also includes a REST Web Service call to the Google Geocoding API to give an example of how those can be incorporated into your list processing

       

       

      Here is what it looks like after you have imported the Process Artifacts in the attached ZIP.  They all have the tag "SFDC Account List Sample"

       

      Use Postman or Advanced Rest Client and give it a try

       

       

      Orchestrate in good health!

       

      Casey.