Loading
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
          Add a Child Flexcard to Itself Recursively (Managed Package)

          Add a Child Flexcard to Itself Recursively (Managed Package)

          For the managed package runtime, when a child Flexcard has hierarchical data, it can call itself recursively. When the Flexcard element is embedded in a child Flexcard, use the Is Recursive feature to display the children and grand-children of parent objects. The child Flexcard can add itself to itself again and again, each time passing the same child data field (also called a data node) available in each level of the data JSON, until that data field no longer exists or is empty.

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

          Required Versions

          Available beginning Summer '21.

          For example, let's say your hierarchical data JSON has a Products data field that lists products within a product. You can display the products, their child products, and grand-child products by embedding the child Flexcard once inside itself, and passing the products data field to itself. The Is Recursive features loops through each Products node and displays the product information based on the elements added to the Flexcard.

          1. From the Omnistudio Flexcards home tab, create a child Flexcard. See Embed Flexcard Inside Another Flexcard (Managed Package).
          2. Add data fields and other elements to the child Flexcard. See Add Elements to a Flexcard (Managed Package).
          3. From the Build panel, drag a Flexcard element onto the canvas.
          4. From the Properties panel, select Is Recursive.
            You can view the actual content of a recursive child Flexcard only in preview mode. In design mode, Salesforce sometimes doesn’t show all of its elements.
          5. Pass data to the children:
            To pass specific attributes, follow these tasks:
            1. In the Attribute field, enter a name for the attribute, such as AccountId.
            2. In the Value field, select a data merge field, such as {Id}.
              FlexCard Recursive Child Attributes
            3. In the data source, reference the attribute as a contextId. For example, {Parent.AccountId}.
              FlexCard Recursive Child Attributes Data Source
            FlexCard Recursive Child Attributes Preview

            To return objects within a specific dataset from the data source, enter the repeating child node in the Data Node field. For example, if your data source has a similar JSON structure as seen in this code sample, enter {record.Products} to display a card for each Products object.

            [
               {
                  "Id": "5123",
                  "Name": "Exit Communications",
                  "Account Number": "QHT123456789",
                   "Phone": "415-987-6543",
                   "Website": "http://www.exitcomm.org",
                   "Contact": "Melrose Oduke",
                   "Contact Phone": "415-333-1234",
                   "Products": [
                     {
                        "Id": "1",
                        "Name": "Product1",
                        "Products": [
                           {
                              "Id": "1_1",
                              "Name": "Product1_1"
                           },
                           {
                              "Id": "1_2",
                              "Name": "Product1_2",
                              "Products": [
                                 {
                                    "Id": "2",
                                    "Name": "Product2",
                                    "Products": [
                                       {
                                          "Id": "2_1",
                                          "Name": "Product2_1"
                                       },
                                       {
                                          "Id": "2_1_2",
                                          "Name": "Product2_1_2"
                                       }
                                    ]
                                 }
                              ]
                           }
                        ]
                     }
                  ]
               }
            ]
            FlexCard Recursive Child Data Node
            FlexCard Recursive Child Data Node Preview
          6. (Optional) To conditionally show the recursive child Flexcard, click +Add New next to Conditions in the Properties panel. See Add Conditions to a Flexcard Element (Managed Package).
            Conditions applied to a recursive child Flexcard, apply to all recursively repeating records. If one record condition returns false, nested records don't show.
          7. To preview the Flexcard at run time, click Preview.
          8. Click Activate.
            Important
            Important Activate the child Flexcard to embed it into a parent Flexcard.
           
          Loading
          Salesforce Help | Article