Loading
Feature Degradation | Agentforce Voice Read More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create Contacts by Using a Loop Block

          Create Contacts by Using a Loop Block

          Use a Loop Block to iterate over a list provided in the input JSON, adding a Contact object for each element in the list.

          For this example, assume the input JSON contains an Account Id and an array of first and last names, like the snippet below.

          {
              "AccountId": "0016100001BKL4uAAH",
              "Contacts": [
                  {
                      "Name": {
                          "First": "John",
                          "Last": "Doe"
                      }
                  },
                  {
                      "Name": {
                          "First": "June",
                          "Last": "Doe"
                      }
                  }
              ]
          }

          To create a contact, you can use a Data Mapper Load. When the script invokes the Data Mapper Load, the Data JSON is sent as input, so the Data Mapper Load can refer directly to the nodes in the input JSON.

          After you create the Data Mapper Load, create a Data Mapper Post Action with properties similar to the properties in the table.

          Data Mapper Post Action Properties
          Property Description
          Data Mapper Interface The name of the Data Mapper Load
          Additional Input
          • Key: AccountId
          • Value: %AccountId%
          • Key: Name
          • Value: %Contacts:Name%

          This passes the first and last name of each contact, along with the AccountId, to the Data Mapper Load on each execution. You can also include more fields, such as phone numbers and email addresses.

          Finally, you can create a Loop block to execute the Data Mapper Post Action for every contact. Use the name of the list of contacts for the Loop List parameter. For example, from the input JSON above, the Loop List would be Contacts. You can use the Additional Output parameter to pass along the execution output from each iteration of the Data Mapper Post Action. For example, if you named the Data Mapper Post Action CreateContact then for the Additional Output key and value you can use CreateContact and %CreateContact%, respectively.

          Data Mapper Post Action output, which can be viewed in the Debug log on the Preview tab, allows other steps in the Integration Procedure to access and use the IDs and other details of the processed sObjects.

          Note
          Note Using an Omnistudio Data Mapper Post action in a Loop Block can sometimes reach the limit of 150 DML statements. See Execution Governors and Limits.
           
          Loading
          Salesforce Help | Article