Loading
Feature Disruption - Service Cloud VoiceRead More
Feature degradation | Gmail Email delivery failureRead 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
          Pass Data from an Omniscript to an Embedded Flexcard

          Pass Data from an Omniscript to an Embedded Flexcard

          To populate data fields and perform actions on a Flexcard embedded in an Omniscript, you can pass data from an Omniscript's data JSON to the Flexcard. Embed a Flexcard inside an Omniscript with the Custom Lightning Web Component element.

          There are three ways to pass data from the Omniscript to the embedded Flexcard:

          Options

          Description

          Pass a set of records

          Use the records global context variable to map data from the LWC Omniscript to an embedded Flexcard.

          Pass the recordId

          Pass the recordId global context variable from the LWC Omniscript to the Flexcard.

          Pass a parent object

          Pass a Parent object containing parent attributes to the Flexcard from the LWC Omniscript. The Omniscript is the parent of the embedded Flexcard. The Parent global context variable, such as {Parent.Id}, must be used in the Flexcard where the merge field is supported.

          Note
          Note

          To update the Flexcard whenever the passed-in Omniscript data changes, add a Property Name of listen-os-data-change and a Property Source of true to the Omniscript's Custom LWC element properties for the Flexcard.

          Map Data from an LWC Omniscript to an Embedded Flexcard

          After embedding a Flexcard inside an LWC Omniscript, map records from the Omniscript to data fields in the Flexcard. For example, populate a list of Flexcards from an array in an Omniscript. In this scenario, the Flexcard uses data from the Omniscript instead of its own data source.

          The data fields on the LWC Omniscript must exist in the Flexcard even if the values are empty. For example, if your Omniscript data JSON has Id, Name, Email, and Phone fields, these field names must exist even if the value of Email or any other fields are empty in the data source of the embedded Flexcard.

          1. In your org, go to the Flexcards tab and click a version of a Flexcard to open the Flexcard Designer. Or, create a new Flexcard. See Create a Flexcard.
          2. In the Setup panel, select and configure the data source with data fields you want the Omniscript to map.

            For example, if your data source is an Omnistudio Data Mapper that gets a list of Accounts, confirm that the Data Mapper Output fields selected include the fields that your Omniscript data JSON maps to. If your Omniscript data JSON has a Name field, so should the Output from the Data Mapper, and so on.

          3. Click Save & Fetch.
          4. From the Build panel, add elements such as Fields, Datatables, and so on onto the canvas. See Add Elements to a Flexcard.
          5. In the Setup panel, check Omniscript Support.
          6. Click Activate.
          7. Embed your Flexcard in an LWC Omniscript with the Custom LWC element in the LWC Omniscript Designer.
          8. In the Custom Lightning Web Component Properties section of the Properties panel, add parent-data as the Property Name, and set the Property Source value to true.
          9. Click + Add New Property.
          10. Enter records as the Property Name, and in the Property Source field, enter the object in the data JSON that lists records that map to the records in your Flexcard. Enter the object as a merge field using Omniscript merge field syntax, such as %objectname%.
            For example, if your list of records is stored in a JSON object called accounts, enter %accounts%.
            To avoid Flexcard loading issues, don’t use the merge field syntax to reference a custom LWC. For example, if the name of the LWC is customlwc1, don’t use %customlwc1%.
          11. Click Activate.
          12. Click Preview to preview the Flexcard inside the LWC Omniscript.

          Pass the RecordId from an Omniscript to Run a Query on a Flexcard

          Pass the recordId context variable from an LWC Omniscript to an embedded Flexcard to run a query on the Flexcard. The query returns the data that populates the Flexcard data fields and actions.

          For example, if your Flexcard has an Omnistudio Data Mapper that gets Account Cases, the fields and actions get updated based on the value of the recordId set in the LWC Omniscript data JSON. If you use the {recordId} merge field in your Flexcard such as in an SOQL query or a Text element, that data that relies on that merge field is also updated based on the recordId coming from the LWC Omniscript data JSON.

          1. In your org, go to the Flexcards tab and click a version of a Flexcard to open the Flexcard Designer. Or, create a new Flexcard. See Create a Flexcard.
          2. Configure your data source if you haven't already. See Set Up a Data Source on a Flexcard.
          3. Add data elements such as Fields, Actions, and so on, from the Build panel onto the canvas. See Add Elements to a Flexcard.
          4. In the Setup panel, check Omniscript Support.
          5. Click Activate.
          6. Embed your Flexcard in an LWC Omniscript with the Custom LWC element in the LWC Omniscript Designer. See Embed Flexcards in an Omniscript.
          7. In the Custom Lightning Web Component Properties section of the Properties panel, add record-id as the Property Name.
            Note
            Note

            Because the Property Name is an HTML attribute, it must be written in kebab case, with words separated by a dash. See Property and Attribute Names.

          8. Set the Property Source to a JSON node that contains a recordId. Use Omniscript merge field syntax, such as %nodename%, to enter the node as a merge field.
            For example, if your recordId is stored in a JSON node called ContextId, enter %ContextId%.
            To avoid Flexcard loading issues, don’t use the merge field syntax to reference a custom LWC. For example, if the name of the LWC is customlwc1, don’t use %customlwc1%.
          9. Click Activate.
          10. Click Preview to preview the Flexcard inside the Omniscript.

          Pass a Parent Object from an LWC Omniscript to Run a Query on a Flexcard

          Pass a Parent object from the LWC Omniscript to the Flexcard. The LWC Omniscript is the parent of the embedded Flexcard. The Parent context variable must be used in the Flexcard where merge fields are supported, such as {Parent.Id}.

          The parent object in the Omniscript data JSON can be named anything as long as it is an object with fields that match the name of the parent attribute that you want the Omniscript to look for in the Flexcard. For example, the JSON object name can be parent or account, such as "parent" : {"Id" : "1234567"} or "account" : {"Id" : "1234567"}.

          1. In your org, go to the Flexcards tab and click a version of a Flexcard to open the Flexcard Designer. Or, create a new Flexcard. See Create a Flexcard.
          2. Configure your data source if you haven't already in Step 1. See Set Up a Data Source on a Flexcard.
          3. Add data elements such as Fields, Datatables, and so on, from the Build panel onto the Canvas.
          4. Add a {Parent} merge field, such as {Parent.Id}, in your Flexcard where merge fields are supported such as in an SOQL query, a Text element, an Input Parameter, and so forth.
          5. In the Setup panel, check Omniscript Support.
          6. Click Activate.
          7. Embed your Flexcard in an LWC Omniscript with the Custom LWC element in the LWC Omniscript Designer. See Embed Flexcards in an Omniscript.
          8. In the Custom Lightning Web Component Properties section of the Properties panel, add parent-attribute as the Property Name, and set the Property Source to the parent JSON object that contains parent attributes. Use Omniscript merge field syntax, such as %objectname%, to enter the node as a merge field.
            For example, if your parent object is stored in a JSON object called account, enter %account%.
            To avoid Flexcard loading issues, don’t use the merge field syntax to reference a custom LWC. For example, if the name of the LWC is customlwc1, don’t use %customlwc1%.
          9. Click Activate.
          10. Click Preview to preview the Flexcard inside the Omniscript.
           
          Loading
          Salesforce Help | Article