Loading
Salesforce now sends email only from verified domains. Read More
Help Agent Performance DegradationRead 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 a Loop Block Example That Adds Values to List Items Using Conditions (Managed Package)

          Create a Loop Block Example That Adds Values to List Items Using Conditions (Managed Package)

          For the managed package runtime, an Integration Procedure adds a dynamic value to each item in a list using conditions. Although dynamic in the list, the values are hard-coded in the Integration Procedure. Use this approach if you know or care about a specific set of possible values.

          Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

          The input looks like this, with uservalue values initially set to null. The uservalue nodes don't have to be included in the input, but it's easier to compare input to output if they are.

          {
            "Labels": {
              "OfferType": "Remediation",
              "BillingCycle": "Immediate"
            },
            "productAttributes": {
              "records": [
                {
                  "record": {
                    "uservalue": null,
                    "label": "BillingCycle"
                  }
                },
                {
                  "record": {
                    "uservalue": null,
                    "label": "OfferType"
                  }
                }
              ]
            }
          }

          The output looks like this, with uservalue values set according to the label value in each list item.

          {
            "Labels": {
              "OfferType": "Remediation",
              "BillingCycle": "Immediate"
            },
            "productAttributes": {
              "records": [
                {
                  "record": {
                    "uservalue": "Immediate",
                    "label": "BillingCycle"
                  }
                },
                {
                  "record": {
                    "uservalue": "Remediation",
                    "label": "OfferType"
                  }
                }
              ]
            }
          }

          The Integration Procedure has these components:

          • A Loop Block, named LoopBlock1

          • A Set Values component within the Loop Block, named SetValues1

          • A second Set Values component within the Loop Block, named SetValues3

          • A Set Values component after the Loop Block, named SetValues2

          • A Response Action, named ResponseAction1

          The Structure panel looks like this:

          The contents of the Structure panel are listed in the preceding text.

          To build this Integration Procedure:

          1. From the Omnistudio Integration Procedures tab, click New.
          2. Provide a unique Integration Procedure Name, a Type that can be a category, and a unique SubType, then click Save. You only have to save this one time.
          3. Drag a Loop Block into the Structure panel and give it the following settings:

            Property

            Description

            Loop List

            Set this value to productAttributes:records.

            Additional Loop Output

            Click Add Key/Value Pair. Set the key to productAttributes and the value to %productAttributes%.

          4. Drag a Set Values component into the Loop Block and give it the following settings:

            Property

            Description

            Element Name

            Name this element IfOfferType.

            Element Value Map, Element Name

            Click Add New Value and assign an Element Name of LabelValue.

            Element Value Map, Value

            Assign a Value of =%Labels:OfferType%.

            Response JSON Path

            Expand Response Transformations and set this value to LabelValue.

            Response JSON Node

            Set this value to productAttributes:records:record:uservalue.

            Execution Conditional Formula

            Set this value to productAttributes:records:record:label == "OfferType".

          5. Drag a second Set Values component into the Loop Block and give it the following settings:

            Property

            Description

            Element Name

            Name this element IfBillingCycle.

            Element Value Map, Element Name

            Click Add New Value and assign an Element Name of LabelValue2.

            Element Value Map, Value

            Assign a Value of =%Labels:BillingCycle%.

            Response JSON Path

            Expand Response Transformations and set this value to LabelValue2.

            Response JSON Node

            Set this value to productAttributes:records:record:uservalue.

            Execution Conditional Formula

            Set this value to productAttributes:records:record:label == "BillingCycle".

          6. Drag a Set Values component below the Loop Block and give it the following settings:

            Property

            Description

            Element Name

            Name this element AssembleOutput.

            Element Value Map, Element Name

            Click Add New Value and assign an Element Name of productAttributes.

            Element Value Map, Value

            Assign a Value of %LoopBlock1:productAttributes%.

            Element Value Map, Element Name

            Click Add New Value again and assign an Element Name of Labels.

            Element Value Map, Value

            Assign a Value of %Labels%.

          7. Drag a Response Action below the last Set Values component and set its Send JSON Path property to AssembleOutput.
          8. Go to the Preview tab and click Edit as JSON.
          9. Copy this JSON data and paste it into the Input Parameters panel:
            {
              "Labels": {
                "OfferType": "Remediation",
                "BillingCycle": "Immediate"
              },
              "productAttributes": {
                "records": [
                  {
                    "record": {
                      "uservalue": null,
                      "label": "BillingCycle"
                    }
                  },
                  {
                    "record": {
                      "uservalue": null,
                      "label": "OfferType"
                    }
                  }
                ]
              }
            }
          10. Click Execute. If you built the Integration Procedure correctly, the output looks something like this:
            {
              "Labels": {
                "OfferType": "Remediation",
                "BillingCycle": "Immediate"
              },
              "productAttributes": {
                "records": [
                  {
                    "record": {
                      "uservalue": "Immediate",
                      "label": "BillingCycle"
                    }
                  },
                  {
                    "record": {
                      "uservalue": "Remediation",
                      "label": "OfferType"
                    }
                  }
                ]
              }
            }

            To correct a component, click it in the Structure panel and edit its properties.

           
          Loading
          Salesforce Help | Article