How to Use SOQL Query From the Data Source Wizard with OmniStudio FlexCards

Building on the knowledge of using the FlexCard and selecting Data Sources which is the important part of the step. Check my previous post of using FlexCard and Data Source Wizard tutorial here.

On this post we focus on using SOQL Query as the Data Source. We use the Salesforce Object Query Language (SOQL) to search the organization’s Salesforce data for specific information. SOQL is similar to SQL but specifically designed for Salesforce.

When using SOQL Query as a Data Source for the Flexcard, the results would be a table. It is used to display repeated rows of data, we can add WHERE clause or LIMIT clause.

Limitation

  • If security is a concern, use a DataRaptor instead of a SOQL query, because DataRaptors fully support field-level security.

Let’s Get Started

Create a new FlexCard and give it a Name, Title, Theme and Author. Keep Is Child Card to false and hit Next.

On the Select Data Source, choose SOQL Query.

On the next screen we can write our SOQL Query.

Select Id, FirstName, LastName, Email, Phone from Contact where AccountId = '{recordId}'

We have the following options:

  • Order By: Field to order the results
  • Reverse Order: Set order to either ASC or DESC
  • Fetch Timeout: Set timeout in milliseconds if query is taking longer.
  • Refresh Interval: Set the interval in milliseconds to check for data changes.

HIt Next. On the Test Inputs screen, we won’t be using the test parameters. Hit the Save and Fetch to retrieve the results to test.

From the Build tab, drag and drop the Text Field to the canvas. Add the Fields like so using the Text Editor.

Activate the FlexCard. An LWC would be compiled from the FlexCard. Go to any account record and Edit the Page using the Lightning Page Builder.

Drag and drop the new LWC component to the layout.

Summary

Using the SOQL query is straightforward. Using SOSL would be similar but differnet syntas. These data sources usage really depends on the requirements. Bit of limited on filtering by context. Better to use DataRaptor or Integration Procedure which we will cover in future post.

One thought on “How to Use SOQL Query From the Data Source Wizard with OmniStudio FlexCards

  1. Hello,
    Thanks for the article.
    This didn’t work for me, when I tried to preview my flexCard, Instead of field value it is showing “output”. I added my flexCard to Lightning record page and same thing showing “output”.

Leave a Reply

Your email address will not be published. Required fields are marked *