You are here:
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.
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.
- From the Omnistudio Flexcards home tab, create a child Flexcard. See Embed Flexcard Inside Another Flexcard (Managed Package).
- Add data fields and other elements to the child Flexcard. See Add Elements to a Flexcard (Managed Package).
- From the Build panel, drag a Flexcard element onto the canvas.
-
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.
-
Pass data to the children:
To pass specific attributes, follow these tasks:
- In the Attribute field, enter a name for the attribute, such as AccountId.
-
In the Value field, select a data merge field, such as
{Id}.

-
In the data source, reference the attribute as a contextId. For example,
{Parent.AccountId}.


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" } ] } ] } ] } ] } ]

-
(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.
- To preview the Flexcard at run time, click Preview.
-
Click Activate.
Important Activate the child Flexcard to embed it into a parent Flexcard.

