FlexCard

How to Call Apex Class In FlexCard

FlexCards are a powerful UI component used to display data dynamically in Salesforce OmniStudio. While FlexCards work efficiently with declarative data sources like DataRaptors and Integration Procedures, there are scenarios where custom business logic is required. In such cases, calling an Apex class from a FlexCard becomes essential. This article explains how to call an Apex class in a FlexCard, when it is needed, and how the data flows from Apex to the FlexCard UI. Why Call an Apex Class from a FlexCard? Although OmniStudio provides strong declarative tools, Apex is required in situations such as: Complex business logic that cannot be handled declaratively Data processing across multiple objects Advanced validations or calculations External integrations that require custom handling Performance optimization for large datasets Calling an Apex class allows FlexCards to display processed, real-time data while keeping the UI responsive. High-Level Architecture The typical flow looks like this: FlexCard calls an Integration Procedure Integration Procedure invokes an Apex class Apex processes the logic and returns data Integration Procedure passes the response back FlexCard renders the data on the UI FlexCards cannot call Apex directly, so Integration Procedures act as the bridge. Step 1: Create an Apex Class Start by creating an Apex class that contains the required logic. The class must: Be declared as global Have a @AuraEnabled method Return data in a format supported by OmniStudio (Map or List) Sample Apex Class global class AccountDataService {          @AuraEnabled     global static List<Account> getAccounts() {         return [             SELECT Id, Name, Industry             FROM Account             LIMIT 5         ];     } }   This example fetches basic Account data that will be displayed in the FlexCard. Step 2: Create an Integration Procedure Next, create an Integration Procedure to call the Apex class. Navigate to Integration Procedures Create a new Integration Procedure Add a Remote Action element Select Apex as the action type Enter the Apex class name and method name Example Configuration: Type: Apex Class Name: AccountDataService Method Name: getAccounts This step enables OmniStudio to execute the Apex logic. Step 3: Configure the Response Mapping Once the Apex method executes, it returns data to the Integration Procedure. Ensure the response is correctly mapped Use the Response Node to capture returned data Validate the response using Preview mode This ensures that the data structure is accessible to the FlexCard. On Preview Tab Step 4: Create or Update the FlexCard Now create or update a FlexCard to consume the Integration Procedure. Open the FlexCard designer Set the Data Source Type to Integration Procedure Select the Integration Procedure created earlier Map the response fields to the FlexCard elements At this stage, the FlexCard is connected to Apex indirectly via the Integration Procedure. Step 5: Display Data on the FlexCard Add UI elements such as: Text fields Data tables Icons or conditional styling Bind these elements to the response nodes returned by the Integration Procedure. For example: {{Account.Name}} {{Account.Industry}}   This displays the data retrieved from the Apex class. Step 6: Preview and Test Preview the FlexCard to verify: Apex class is executed successfully Integration Procedure returns data correctly FlexCard displays the expected output No runtime errors occur Testing ensures smooth data flow from Apex to UI. Best Practices for Calling Apex in FlexCards To ensure performance and maintainability, follow these best practices: Keep Apex logic lightweight and efficient Avoid unnecessary SOQL queries Always handle exceptions in Apex Return only required fields Use Integration Procedures for orchestration Test with large datasets to avoid performance issues These practices help maintain scalable and reliable FlexCard implementations. Common Use Cases Calling Apex from FlexCards is commonly used for: Aggregated or calculated data Conditional record processing External API data handling Custom eligibility checks Complex data transformations This approach extends FlexCard capabilities without compromising flexibility. Conclusion Calling an Apex class in a FlexCard is a powerful technique that enables advanced data handling in OmniStudio applications. While FlexCards do not directly invoke Apex, using an Integration Procedure as a bridge ensures a clean and scalable architecture. By combining declarative tools with Apex logic, developers can build dynamic, high-performing FlexCards that meet complex business requirements while maintaining a responsive user experience.

How to Call Apex Class In FlexCard Read More »

How to use SOSL in FlexCard (Vlocity)

FlexCards in OmniStudio provide a powerful way to display Salesforce data dynamically on the UI. While FlexCards commonly use DataRaptors and Integration Procedures as data sources, there are scenarios where SOSL (Salesforce Object Search Language) is more effective. SOSL is particularly useful when you need to search across multiple records or perform text-based searches efficiently. In this article, we will walk through how to use SOSL in a FlexCard to retrieve Account data and display it on the screen. Why Use SOSL in FlexCard? SOSL is designed for searching text across multiple objects or fields quickly. Using SOSL in a FlexCard is beneficial when: You need fast text-based searching You want to retrieve records based on search terms You need to fetch data without complex filters Performance is a priority SOSL works well when searching by names, keywords, or other text fields. Use Case Overview In this example, we will create a FlexCard that uses SOSL as its data source to retrieve Account records. The fetched data will then be displayed on the FlexCard canvas using standard UI elements. Step 1: Create a FlexCard and Select SOSL as Data Source Start by creating a new FlexCard. Open FlexCard Designer Create a new FlexCard Navigate to the Data Source section Set Data Source Type to SOSL After selecting SOSL, configure the SOSL query based on your requirement to retrieve Account data. Once configured: Click on Save & Fetch Verify that the data is successfully returned This step confirms that the SOSL query is working correctly. Step 2: Build the FlexCard UI After fetching the data, move to the Build section of the FlexCard. Navigate to Build > Fields Drag required fields onto the FlexCard canvas Bind the fields to the SOSL response data For example, you can display: Account Name Industry Phone Number The dragged fields automatically map to the returned SOSL data nodes. Step 3: Configure Field Mapping Ensure the fields are correctly mapped to the SOSL response. Verify the data path for each field Use the data tree to confirm field availability Adjust field labels and formatting as required Proper mapping ensures that the FlexCard displays accurate and consistent data. Step 4: Preview the FlexCard Once the UI configuration is complete: Click Preview Validate that Account data appears correctly Confirm that the SOSL query returns expected results Check for performance and formatting issues Previewing helps catch mapping or query errors early. Best Practices for Using SOSL in FlexCard When using SOSL in FlexCards, follow these best practices: Keep SOSL queries efficient and focused Avoid retrieving unnecessary fields Use SOSL for search-based use cases only Test performance with large datasets Ensure proper field-level security access These practices help maintain optimal performance and user experience. Common Use Cases SOSL in FlexCards is commonly used for: Global search functionality Keyword-based record lookup Quick customer or account searches Lightweight data retrieval for dashboards Fast UI response scenarios Conclusion Using SOSL as a data source in FlexCards is a simple yet powerful way to retrieve Salesforce data efficiently. By selecting SOSL in the data source configuration and binding fields to the UI, you can quickly build responsive FlexCards for search-based use cases. This approach reduces complexity while delivering fast and accurate results, making it an excellent option for scenarios where text-based searching is required.

How to use SOSL in FlexCard (Vlocity) Read More »

How to use Blank Card State In Flexcard.

FlexCards in OmniStudio provide a dynamic way to display data fetched from different sources such as DataRaptors and Integration Procedures. However, there are situations where a data source returns zero records. In such cases, showing a blank screen or broken UI can confuse users. To handle this gracefully, FlexCards provide a feature called Blank Card State. In this article, we will learn how to use the Blank Card State of a State element in FlexCard and understand how it helps manage scenarios where no data is returned. What Is Blank Card State? The Blank Card State is used when a FlexCard’s data source returns no records. Instead of showing empty fields or no UI at all, the Blank Card State allows you to display a custom message or layout, informing the user that no data is available. This improves user experience by clearly indicating that: No records were found The search returned no results Input parameters may be missing or incorrect Use Case Overview In this example, we will: Use a FlexCard State element Configure a DataRaptor Extract as the data source Display data when records are available Show a custom message when zero records are returned using the Blank Card State Step 1: Create a FlexCard and Configure DataRaptor Start by creating a new FlexCard. Open FlexCard Designer Create a new FlexCard In the Setup section, select DataRaptor as the data source Next, create a DataRaptor Extract that will fetch Account data. Map all the required fields such as Name, Phone, or other relevant fields Ensure the DataRaptor is correctly configured and tested This DataRaptor will act as the main data source for the FlexCard. Step 2: Configure Interface Name and Input Mapping Move to the Setup section of the FlexCard. In the Interface Name field, search for and select the DataRaptor name Navigate to the Input Map section Add a new input mapping with the following values: Key: AccName Value: Rec This configuration allows the FlexCard to pass a test parameter dynamically. The value entered in the test parameter will be used to search records in the DataRaptor. After completing the mapping: Click Save & Fetch Verify whether records are returned correctly Step 3: Build the FlexCard UI and Configure Blank Card State Now move to the Build section of the FlexCard. Drag the required fields from the Fields panel onto the canvas Add a State element (or clone an existing one) Enable the Blank Card State option in the State element Next, map the same DataRaptor name and input configuration used earlier to this State element. To display a message when no records are found: Drag a Text element inside the Blank Card State Enter a custom message in the Text property, such as: “No records found. Please provide valid input to search.” This message will be displayed whenever the DataRaptor returns zero records. Step 4: Preview and Test the FlexCard Preview the FlexCard to validate the functionality. Test Case 1: With Input Parameter Click Add Test Params Enter an Account name (for example, “Acme”) in the value field If a matching record exists, the FlexCard will display the record details Test Case 2: Without Input Parameter Leave the test parameter blank The DataRaptor query executes with an empty value, similar to: SELECT Id, Name, Phone WHERE Name = ”   This query returns null data The Blank Card State is triggered The custom message is displayed on the screen If we leave it without filling the parametere it will  get the query like “Select id ,Name ,phone where name = ” ”.  with this it return null data. Why Use Blank Card State? Using Blank Card State offers several benefits: Improves user experience Avoids empty or broken UI Clearly communicates no-data scenarios Supports dynamic search-based use cases Reduces confusion during testing and runtime It is especially useful when working with search parameters, filters, or optional inputs. Best Practices Always provide a meaningful message in the Blank Card State Keep the UI simple and informative Test both data and no-data scenarios Ensure input mappings are consistent across states Avoid complex logic inside the Blank Card State Conclusion The Blank Card State in FlexCard is a simple yet powerful feature that helps handle zero-record scenarios effectively. By configuring a State element with a Blank Card State, you can display custom messages and maintain a clean, user-friendly interface even when no data is returned. This approach ensures that FlexCards behave predictably and provide clear feedback to users, making your OmniStudio implementations more robust and professional.

How to use Blank Card State In Flexcard. Read More »

How to Pass Data Parent FlexCard to Child FlexCard

In this post, we will learn how to pass data from a Parent FlexCard to a Child FlexCard in OmniStudio (Vlocity). We will create two FlexCards—one parent and one child—where the child FlexCard queries Account records and displays the data inside the parent FlexCard. This approach is commonly used to build modular, reusable, and dynamic UI components in Salesforce OmniStudio. Ways to Pass Data to a Child FlexCard in Vlocity There are two primary ways to pass data from a parent FlexCard to a child FlexCard: 1. Using Data Nodes Data Nodes are used to query Salesforce data and pass the results to a child FlexCard. Data Nodes fetch records using SOQL, DataRaptors, or Integration Procedures The queried data is automatically available to the child FlexCard Best suited when the child FlexCard needs record-based or structured data 2. Using Attributes Attributes act as input parameters passed from the parent FlexCard to the child FlexCard. Attributes enable dynamic customization Specific values can be passed directly to the child FlexCard Useful when the child FlexCard needs filtered or contextual data from the parent Using attributes allows us to pass specific values from the parent FlexCard to the child FlexCard efficiently. Step 1: Create the Child FlexCard to Query Account Data In this step, we create the child FlexCard that will query Account records. Create a new FlexCard with a proper Name and Description Configure a Data Source (SOQL, DataRaptor, or Integration Procedure) Query the required Account fields such as Name, Phone, or Industry Save and Fetch the data Drag the required fields from the Build section to the canvas This child FlexCard will be responsible for displaying Account-related information. In Child FlexCard Step 2: Enable Child Card Settings in the Child FlexCard To establish a parent-child relationship: Open the child FlexCard settings Set “Is Child Card” = true Save and Activate the FlexCard This step is mandatory; without enabling the child card option, the FlexCard cannot be embedded inside a parent FlexCard. In Parent Card On Parent Setup Panel On parent flexcard preview tab  On preview tab Step 3: Configure Parent FlexCard Now, create the parent FlexCard: Create a new FlexCard with a proper name and description If required, define Attributes that will be passed to the child FlexCard These attributes can include Account Name, Record Id, or other parameters Step 4: Access Parent Data in Child FlexCard To access data from the parent FlexCard inside the child FlexCard, use the following syntax: {Parent.attributeName}   Replace attributeName with the actual attribute or data node name defined in the parent FlexCard. This allows the child FlexCard to dynamically use values coming from the parent. Step 5: Add Child Card Component to Parent FlexCard In the parent FlexCard: Go to the Build section Drag and drop the CHILD CARD component onto the canvas Select the child FlexCard name Map attributes or data nodes as required Once configured, the child FlexCard will render inside the parent FlexCard and display Account data accordingly. Conclusion Passing data from a parent FlexCard to a child FlexCard is a powerful feature in OmniStudio that helps build scalable and reusable UI components. By using Data Nodes or Attributes, you can control how data flows between FlexCards and create flexible user experiences. This pattern is especially useful when working with Account details, related records, or contextual views within Salesforce.

How to Pass Data Parent FlexCard to Child FlexCard Read More »

How To Use Flexcard Context Variables(salesforce)

Context Variables in Salesforce:      In Salesforce, context variables typically refer to variables that store information specific to the current context or execution environment. These variables can be used to pass data between different elements of a process or to control the behavior of a process. Context variables can be used in various Salesforce features, including Process Builder, Flows, Apex code, and Lightning components. —  Global and local context variables are available to a FlexCard to provide context to data sources, actions, and other components. All variables are case sensitive.  Global Variables — /*! elementor – v3.18.0 – 20-12-2023 */ .elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px} NAME Label   2. Params   3. Parent       4. recordId             5. records MERGE FIELD   {Label.mylabel}     {Params.fieldName}     {Parent.attributeName}  example, Parent.Id gets the {Id} attribute defined on the parent FlexCard. {recordId}             {records} DESCROPTION For example, {Label.AccountName} gets a custom label named AccountName. For example, {Params.Id} gets the context Id. We recommend using {recordId} to get the context Id of a record. Reference attributes from the parent FlexCard on the child FlexCard with this variable. Attributes are defined at design time on the parent FlexCard. correct it. if using a DataRaptor to get a list of Account Cases, in the Input Map, enter AccountId as Key and {recordId} as the Value. Then add a Test Parameter whose Key is recordId and Value is 138238279r9ff to populate your FlexCard with actual data. For example, {records} gets all records, while {records [0]} gets the first available record. Salesforce Guide – https://help.salesforce.com/s/articleView?id=sf.os_flexcards_context_variables_42922.htm&type=5

How To Use Flexcard Context Variables(salesforce) Read More »

How To Enable Flex Card in OmniStudio(Vlocity) Salesforce

“We will explain in this blog how to enable Flex Cards. Step1: Open OmniStudio in App Manager Step2: As you unfold the Flex Card, a thoughtful message emerges, gently reminding you that the creation of this card awaits resolution of the associated warning. To fix this warning, go to the warning tab and find two links. Click on each link, and it will take you to Remote Site Settings. Before that, go to setup. You need to set up the remote site before making a flex card; otherwise, there might be an error when creating the flex card. I hope you understand how to Enable Flex Card in Salesforce.

How To Enable Flex Card in OmniStudio(Vlocity) Salesforce Read More »

How to use Exposed Attributes in FlexCard

— :  “In this post, we will create Exposed Attributes in FlexCard to display data in text fields. Step :– 1 First, create a FlexCard. In the FlexCard setup, navigate to Setup > Exposed Attributes > Add New.          After clicking on ‘Add New,’ the screen will be displayed as shown in the image below.” /*! elementor – v3.18.0 – 20-12-2023 */ .elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=”.svg”]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block} In Setup Exposed Attributes In   — Attributes: Enter the name of the attribute. Type: Select the desired attribute type: String, Integer, or Boolean. Targets: Specify where the FlexCard attribute should be exposed. Label: Enter the label text that will be displayed in the Lightning App Builder when you add the FlexCard. Default Value: Optionally, enter default values for the attribute. To access the Exposed Attributes in the FlexCard, use the syntax: {Session.AttributeName} wherever merge fields are supported in the FlexCard.” Exposed Attributes Step :–2  “Drag a Text component from Build > Display > Text in the Properties.”  In Text Field Paas {Session.AttributeName} Salesforce Guide – https://help.salesforce.com/s/articleView?id=sf.os_create_a_public_property_for_a_flexcard_lwc_in_the_flexcard_designer_41483.htm&type=5

How to use Exposed Attributes in FlexCard Read More »

How To Maken Navigate Action in FlexCard

–: “In this post, we will create a Navigate Action to navigate to the 9to9clouds page. Step 1: Create a FlexCard: Set the data source to ‘None.’ Navigate to the ‘Build’ section. Under ‘DISPLAY,’ select ‘Action.’ Drag and drop the Action component onto your workspace.” /*! elementor – v3.18.0 – 20-12-2023 */ .elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=”.svg”]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block} Drage a Action Configure the Action: Inside the Action component, configure the properties. Set the target or action type to “Navigate.” Navigate Action Step :– 2  “Activate” the FlexCard click on “Preview”  And Click on Action  In Preview Tab Result /*! elementor-pro – v3.18.0 – 20-12-2023 */ .elementor-slides .swiper-slide-bg{background-size:cover;background-position:50%;background-repeat:no-repeat;min-width:100%;min-height:100%}.elementor-slides .swiper-slide-inner{background-repeat:no-repeat;background-position:50%;position:absolute;top:0;left:0;bottom:0;right:0;padding:50px;margin:auto}.elementor-slides .swiper-slide-inner,.elementor-slides .swiper-slide-inner:hover{color:#fff;display:flex}.elementor-slides .swiper-slide-inner .elementor-background-overlay{position:absolute;z-index:0;top:0;bottom:0;left:0;right:0}.elementor-slides .swiper-slide-inner .elementor-slide-content{position:relative;z-index:1;width:100%}.elementor-slides .swiper-slide-inner .elementor-slide-heading{font-size:35px;font-weight:700;line-height:1}.elementor-slides .swiper-slide-inner .elementor-slide-description{font-size:17px;line-height:1.4}.elementor-slides .swiper-slide-inner .elementor-slide-description:not(:last-child),.elementor-slides .swiper-slide-inner .elementor-slide-heading:not(:last-child){margin-bottom:30px}.elementor-slides .swiper-slide-inner .elementor-slide-button{border:2px solid #fff;color:#fff;background:transparent;display:inline-block}.elementor-slides .swiper-slide-inner .elementor-slide-button,.elementor-slides .swiper-slide-inner .elementor-slide-button:hover{background:transparent;color:inherit;text-decoration:none}.elementor–v-position-top .swiper-slide-inner{align-items:flex-start}.elementor–v-position-bottom .swiper-slide-inner{align-items:flex-end}.elementor–v-position-middle .swiper-slide-inner{align-items:center}.elementor–h-position-left .swiper-slide-inner{justify-content:flex-start}.elementor–h-position-right .swiper-slide-inner{justify-content:flex-end}.elementor–h-position-center .swiper-slide-inner{justify-content:center}body.rtl .elementor-widget-slides .elementor-swiper-button-next{left:10px;right:auto}body.rtl .elementor-widget-slides .elementor-swiper-button-prev{right:10px;left:auto}.elementor-slides-wrapper div:not(.swiper-slide)>.swiper-slide-inner{display:none}@media (max-width:767px){.elementor-slides .swiper-slide-inner{padding:30px}.elementor-slides .swiper-slide-inner .elementor-slide-heading{font-size:23px;line-height:1;margin-bottom:15px}.elementor-slides .swiper-slide-inner .elementor-slide-description{font-size:13px;line-height:1.4;margin-bottom:15px}} Thank You use Navigate Action in FlexCard we are creating vlocity suctions9to9cloudsWelcome in our website 9to9clouds.com HomeThanks for Viste! we are 9to9clouds for salesforce development Click for more content Previous slide Next slide Salesforce Guide =https://help.salesforce.com/s/articleView?id=sf.os_navigate_from_a_flexcard_with_the_navigate_action_27228.htm&type=5

How To Maken Navigate Action in FlexCard Read More »

How to make custom Edit block using Flexcard.

Step :- 1 Here we will create a flexcard. Create FlexCard After Creating FlexCard  ,Go to setup and Selcet Data Source as  Soql , – write this  Select id, Name , phone from Account  and click on save &fetch – Drag all the  field into canvas. Selecting fields   Drag an Action element on Canvas to perform  an action ,    In the property of action  Click on action , Select Flyout in action type . Select   Omniscript in Flyout Type . Create a omniscript  and fill  the Omniscript’s  Name  in the  Flyout Field. Send  the attributes to the Omniscript that we have created in key and value form :-         Fill all the above data according to this pic.in flexcard. Sending data through flyout Step 2 :-            Open the previously created omniscript. and drag a set value to recieve the Attribute  in the key value form. –  take a step  two fields in it and  a  integeration procedure in it. Create an ip   1:- Give same name to Name and Phone field as given in set value .   pass variable to field 2:- Take an  integeration procedure as above. Click on ip. — Click on  Remote property  and  in Extra payload  send all field. — Check  the  send only extra payload button . Sending data to ip Step 3  :– Open the  previously created Integeration procedure/IP.   — Take a DataRaptor post  Action in Integeration procedure . click on dataraptor and  go on additional input  map the data like below image. receive data from os Step 4 :-   Open the dataraptor and  map the data in dataraptor. — select the  account  from object section  and map fields from below pic .  Step :-5  Testing of Edit Functionality.  — Activate The  IP ,, Os ,, FlexCard. that we have created in  This Blog . — Preview the  FlexCard and we see in below image Before Edit.   Name =  Testimg Account.   Preview image Flex Card After edit Account Name. Refresh the page to see the change. Name is Change Manually In FlexCard . Change

How to make custom Edit block using Flexcard. Read More »

Scroll to Top