Query
The Avonni Query Data Source enhances how you fetch and use Salesforce data within supported Avonni components inside your Flows. Configure queries visually, directly within components like Data Table or List, offering more control and flexibility than standard Flow data elements for displaying rich, interactive data.
What is the Avonni Query Data Source?
The Avonni Query Data Source is not a standalone Flow element you drag onto the canvas. Instead, it's an integrated data retrieval option found within the properties of specific Avonni Flow components (e.g., Data Table, List, Carousel, Map).
When you add one of these Avonni components to your Flow screen, you'll find a "Data Source" section in its properties panel. Selecting "Query" here allows you to define how Salesforce data is fetched and filtered for that specific component instance, all without writing SOQL code.

Building Your Query (Visually)
Avonni provides a user-friendly visual interface that allows you to construct your data queries directly within the component's settings in Flow Builder.
Select the Salesforce Object: Choose the object you want to query (e.g., Accounts, Contacts, Opportunities, or custom objects).
Set Filter Conditions (Static Filters): Define criteria to narrow down your records. Use fields, operators (e.g., equals, greater than, contains), and specific values. These filters are applied when the query first runs.
Use Grouping Conditions: Create more complex filter logic by grouping conditions with
AND
/OR
operators.Configure Sorting: Specify the field(s) to sort your results by and the direction (ascending or descending).
Example: Querying Opportunities
This example demonstrates how to use the visual query builder to display opportunities closing this month, grouped by stage:
Build the Query Visually
The Avonni component's interface guides you through constructing the query:
Select the Object: Choose "Opportunity" as the object for your data.
Define Filters: To focus on opportunities closing this month, use the filter options:
Select the "CloseDate" field.
Choose the "equals" operator.
Select "This Month" as the value. This dynamically filters the data only to include opportunities with a close date within the current month

Group Data: To organize the results by stage, use the "Group By" option and select the "StageName" field. This will group all opportunities with the same stage

Configure the Data Table Columns
Map the query results to the Data Table columns:
Name: Map this to an "Opportunity Name" column.
StageName: Map this to a "Stage" column.
Amount: Map this to an "Amount" column.
Probability: Map this to a "Probability" column.
LastModifiedDate: Map this to a "Last Modified Date" column

Step 5: Connect the Flow: Finally, connect the Data Table to the rest of your Flow logic as needed
Key Benefits
Simplified Query Creation: Build queries visually without writing SOQL.
Access to Larger Datasets: Can retrieve more records than the standard Flow "Get Records" limit of 50,000 (subject to overall Salesforce limits).
Dynamic Updates with Reactive Queries: Enables components to automatically refresh data based on other Flow screen inputs or actions (detailed below).
Reactive Queries: Making Your Components Interactive
Reactive queries allow your Avonni components within a Flow screen to dynamically respond to user actions or changes in other Flow screen variables.
POWER TIP: Alternatives to Screen Flows for Data Display
If you're currently using Screen Flows to display information on a page (without any complex logic), consider switching to Avonni Dynamic Components package. You'll get faster loading times and a more straightforward setup for your data queries on Lightning Pages.
What are Reactive Screens?
They enable screen components to update their data instantly in response to user interactions or changes to Flow variables, making your data displays genuinely interactive.
How Reactive Queries Work
You create a Text Formula resource within your Flow. This formula defines the dynamic part of your query's filter criteria (like a WHERE
clause). The Avonni component re-evaluates this formula and re-runs its query whenever the inputs to the formula change. For a practical example, see the Reactive Query Example section below.
Example
Imagine a Flow screen where a user selects an Account from a picklist. A reactive query in an Avonni Data Table could then automatically filter and display only the Opportunities related to that chosen Account ID. When the user picks a different Account, the Data Table updates instantly. For a detailed walkthrough, see the How to make Data Tables Reactive Tutorial.
Tutorials
Advanced Query Features
The Avonni Components lets you add conditions to your data queries, similar to using the 'WHERE' clause in a Salesforce query. This allows you to specify precisely what data you want to pull in.
If you create filters directly in the filter menu (by selecting fields, adding operators and values, or grouping conditions), they won't automatically change when other components on your screen are updated; they stay fixed.
You can find more information about creating reactive filters here.
Using 'Custom Fields'
The 'Custom Fields' section lets you add particular fields straight into your queries, bypassing the need to put them in the Avonni data table. This leads to a more customized querying approach, where you can include the fields needed for specific tasks or later steps.
Why use "Custom Fields":
Allowing you to add specific fields directly Enhanced Flexibility: Customize your queries by including only the essential fields to particular interactions or screens.
Improved Efficiency: Allowing you to add specific fields directly streamlines the querying process, making it quicker and more efficient.
Focused Queries: This helps create more concentrated and precise queries by utilizing only the required fields, avoiding unnecessary clutter in the data table.

Example of Setting Filter Conditions
Imagine you're working with Salesforce data and want to retrieve contact records in 'New York.' Here's how you can set this up:
Specify the Field: Choose the field to which you want to apply the filter, such as 'Location'.
Add the Filter Condition: In the filter condition, specify 'equals' and then 'New York'. This is analogous to writing a SOQL query where you would include
WHERE Location = 'New York'
.

This setup ensures that your query will only return contacts located in New York, filtering out all other records.
Grouping Conditions in Queries
To retrieve contacts in "New York" or "San Francisco" who are also "Active," you would create a group with two conditions ("Location" equals "New York" OR "Location" equals "San Francisco") and then add another condition outside the group ("Status" equals "Primary").

Understanding Query Operators
The visual query builder supports various operators:
Logical Operators: AND, OR, NOT
Comparison Operators: =, <>, <, >, <=, >=
Set Operators: IN, NOT IN
String Operators: LIKE, NOT LIKE
Null Operators: NULL, NOT NULL
Some operators may not be available depending on the type of field you're trying to filter. For example, you can't use LIKE with a number field. Refer to Salesforce documentation for details on which operators are compatible with each field type.
Platform Events Integration
The Query Data Source can connect to Platform Events for real-time updates, allowing components to react instantly to certain changes in Salesforce data. For a configuration tutorial, see Platform Events Configuration Tutorial.
System Mode
The System Mode option, when enabled for an Avonni Query Data Source, allows the data retrieval for that specific query to operate with broader permissions than those of the currently logged-in user. This is a powerful feature designed to ensure your component can display all necessary information for its intended purpose, even if the viewing user's individual sharing settings or profile permissions would usually restrict their access to some of the underlying Salesforce records.
How it Works
When System Mode is active for a query:
The query effectively runs in a system context for data retrieval, bypassing the viewing user's specific record-level sharing rules and potentially some Field Level Security (FLS) for read operations only.
This allows the query to fetch a more complete dataset, which is then used to populate your Avonni component.
Crucial Security Considerations & Limitations
Read Access Elevation Only: System Mode primarily elevates permissions for viewing or reading data. It does not allow users to edit, create, or delete data that they do not have explicit permission to modify through their standard Salesforce profile, permission sets, and object/field-level security for write operations. Salesforce's standard security for data modification remains entirely in effect.
Use Judiciously and Responsibly: While System Mode can be essential for ensuring complete data visibility within a component, it bypasses user-specific sharing for read access.
Always consider the sensitivity of the data being exposed.
Ensure that displaying this data in a system context is appropriate for all intended users of the component.
It is a tool to ensure your component functions correctly by having access to necessary data, not a general bypass of Salesforce security.

Troubleshooting Reactive Queries
Are you having trouble getting your reactive query formula to work correctly? Here's a breakdown of how to troubleshoot and achieve the desired results:
Step 1: Visualize Formula Output
Use a Display Text element to show the exact value your formula produces. This helps you determine if the formula's output aligns with your SOQL query. Think of it as a sneak peek into the result of your formula.

Step 2: Test with Direct SOQL
Test your formula directly within a SOQL query. Remember to adjust it by:
Removing any extra symbols or variable references specific to Flow Builder.
Replacing placeholders with real values from your Salesforce data.

Interpreting the Results
Success! If your SOQL query returns the expected results, congratulations! Your formula is likely correct.
Error? If Salesforce throws an error message, it means there's something wrong with the syntax or structure of your query. Carefully review your formula for any mistakes.
Example
Let's say your formula looks like this:
"Name LIKE '%"&{!NameInput.value}&"%' AND Account.Industry = '"&{!IndustryCombobox.value}&"'"
To use this in a SOQL query, you'd modify it to:
SQL
Name LIKE '%Acme%' AND Account.Industry = 'Technology'
Use code with caution.
Important Considerations
If your SOQL query with the modified formula throws an error, your original formula might have a syntax issue.
Ensure the values you use in your test SOQL query are valid and exist in your Salesforce org.
By following these steps, you can effectively pinpoint and resolve issues with your reactive query formulas.
Still Stuck?
If your SOQL test works and the formula output looks correct, but the component isn't filtering as expected, contact our support team for assistance!
Last updated
Was this helpful?