Skip to main content

Combine Internal Data for FlexCards

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe the data sources for FlexCards.
  • Describe JSON nodes and subnodes.
  • Build with multiple nodes in the JSON output.

Data Sources for FlexCards

For the most part, FlexCards work with OmniStudio data tools in the same way that OmniScripts do. Remember—it’s possible to connect the same Integration Procedure or Data Mapper to more than one OmniStudio component. In this unit, we show how these OmniStudio data tools combine data for more than one FlexCard.

Here’s an Account FlexCard that displays the Account’s name, Primary Contact, Phone number, Website, and Postal Code.

An Account FlexCard

And here’s a Contact FlexCard that displays the Account’s Contacts, including their names, email addresses, and phone numbers.

A Contacts FlexCard

How do you retrieve data for both of these FlexCards using a single Integration Procedure? Let’s start by examining the data sources available for FlexCards. There are several data input options for a FlexCard. When it comes to inputting data, Integration Procedures are a best practice because Integration Procedures separate the data configuration from the FlexCard configuration. You can learn more about this in the OmniStudio Integration Procedures module.  

However, there are a few scenarios where using an Integration Procedure is not recommended.

Data Source

When to Use This Data Source

Streaming API

For automatic updates when data changes

Salesforce Object Search Language (SOSL) 

For text field searches across Salesforce objects

Sample

For display or testing of static data

When an account-based FlexCard displays on a console, the Account RecordId passes to the FlexCard on a variable called {recordId}. You pass this to an Integration Procedure via a variable named AccountId. All of these variable names are arbitrary but must match for the data to flow correctly. 

Corresponding diagram of information

The Integration Procedure passes the AccountId to a Data Mapper Extract. The Data Mapper Extract then uses the AccountId to identify a unique Salesforce record, and through a series of Salesforce Object Query Language (SOQL) queries, requests data from Salesforce. These queries return the AccountId and other fields from the Account record and other fields from associated Contact records. 

Corresponding diagram of information

The Data Mapper maps and returns the data to the Integration Procedure, which then passes it back to the FlexCard. This JSON populates the FlexCard and any child FlexCards with the data that end users see on the console.

Corresponding diagram of information

What Are JSON Nodes and Subnodes?

Data in a JSON is divided into nodes and, sometimes, subnodes. 

JSON nodes and Subnodes on Account data and Contact data

The JSON data below has two nodes: Account data (1) and Contact data (2). Each node is set off by a colon : and a curly bracket { }. Additionally, the Contact node has two subnodes—one for each Contact (3). Each of these is set off by a curly bracket.

The JSON structure that best supports use on multiple FlexCards uses parent nodes for each FlexCard. Filtering the Result JSON Path trims the data and pulls only relevant data to the FlexCard.

Contact and Account Result Parent JSON Paths pull only the data relevant to each FlexCard

Build with Multiple Nodes in JSON Output

Now that we’ve walked through FlexCard data sources and JSON nodes and subnodes, let’s start with the Data Mapper Extract we need to build with multiple nodes.

The order of extract steps in a Data Mapper is important to refer to data from another step. In this Data Mapper’s Extract tab, you need to execute the following steps.

  1. Retrieve the account data.
  2. Retrieve contact data related to the account.
  3. Filter using a particular field in the account (the Primary Contact field). In a Data Mapper, you can use filter criteria from an object used in an earlier Extract step.

The Extract tab shows one Extract Output Path for Account and two for Contact

In the Output tab, create the mappings between the extract step JSON to the output JSON for both the Account and Contact objects. 

To create a subnode, use a colon when mapping the Output JSON Path. For example, Account:AccountName and Account:AccountWebsite creates an Account node that lists the AccountName and AccountWebsite fields.

The Output tab displays mappings for Account and Contact fields

Now let’s take a look at how you configure the Integration Procedure.

When you create an Integration Procedure, add a Data Mapper Extract Action (1) to the Structure panel. Use the Data Mapper Interface field (2) to connect the Integration Procedure and the Data Mapper.

Set the Integration Procedure as the data source for the Account and Contacts FlexCards, and now you have a single Integration Procedure that retrieves data for both the Account and Contacts FlexCards. Way to go!

You’re now familiar with how OmniStudio data tools handle internal data. To learn how these tools work with data from external sources, head to the OmniStudio Data Tools and External Data module.

Resources

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기