Query
Avonni Query Data Source: A Powerful Way to Access Your Data
The Avonni Query Data Source gives you more control over getting data from Salesforce, going beyond the standard "Get Records" functionality in your flows. It's like a direct line to your Salesforce data, allowing for more flexibility and customization.
Benefits of Using the Avonni Query Data Source
Access More Data
Retrieve data beyond the 50,000-record limit of "Get Records."
Advanced Queries
Use SOQL (Salesforce Object Query Language) to create complex queries, including subqueries and precise filtering.
Choose Specific Fields
Select only the fields you need, making your queries faster and more efficient.
Dynamic Filtering
Build interactive components that update instantly based on user actions.
Efficient Batch Processing
Handle large amounts of data by retrieving it in smaller, manageable batches.
How to Use Query Mode
Open any supported Avonni Component (Data Table, List, Carousel, Map) in the Flow Builder.
Navigate to the '
Data Source
' section and select 'Query
'.A query editor will appear, enabling you to input your query directly.
Configuring Query Filters
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.
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
Avonni Query Data Source also allow grouping multiple conditions, enhancing the query's precision.
Suppose you want to retrieve data of contacts in 'New York' or 'San Francisco' and have an 'Active' status. Here's how to group these conditions:
Click on the "Add Groups" link
Set the First Condition: As before, set a condition for the '
Location
' field to 'New York
'.Add Another Condition: Add a second condition for '
Location
' set to 'San Francisco
'.Add Status Condition: Now add another condition outside this group for the 'Status' field set to 'Primary'.
In this setup, the query will return contacts in New York or San Francisco and simultaneously have an 'Active' status.
Understanding Query Operators
Understanding query operators is crucial for getting the exact data you need when using the Avonni Query Data Source. These operators empower you to filter and sort your data efficiently.
Here's a breakdown of the available operators:
Logical Operators:
AND
,OR
,NOT
Comparison Operators:
=
,<>
,<
,>
,<=
,>=
Set Operators:
IN
,NOT IN
String Operators:
LIKE
,NOT LIKE
Null Operators:
NULL
,NOT NULL
Key Operators Explained:
LIKE: Use
LIKE
for partial matches. For example,Name LIKE '%John%'
it finds records where the Name field contains "John" anywhere.IN: The
IN
operator lets you check if a value is within a list of values, making your queries more compact and readable.NOT IN: Use
NOT IN
to exclude records matching any listed values.ASC NULLS LAST & DESC NULLS LAST: These options control how null values are sorted, either placing them at the end of the results when sorting in ascending or descending order.
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" lets you connect your query to Salesforce Platform Events. Consider Platform Events as Salesforce's built-in instant messaging system, allowing different parts of your system or external applications to communicate seamlessly and instantly.
How Does This Benefit Your Flows?
Imagine multiple sales reps working from the same list of leads. When one rep claims a lead, you want it to vanish from everyone else's list immediately. This prevents confusion and ensures everyone has the most current information. That's where Platform Events shine.
Real-time Collaboration: Platform Events trigger instant updates across your Flow, so everyone sees the same, accurate data, no matter how many people use it simultaneously.
No More Conflicts: Changes are reflected instantly, avoiding situations like multiple reps trying to work on the same lead.
Better User Experience: A responsive, up-to-the-minute interface keeps your users happy and productive
Avonni Data Components and Platform Events
Avonni's Data Components (like Data Tables, Kanbans, Lists, Calendars, and Maps) are now designed to harness the power of Platform Events. They can listen for and react to these real-time messages, automatically updating your Flows without manual refreshes. This creates a more dynamic and collaborative user experience.
Configuration tutorial
Learn how to build a Salesforce datatable that refreshes when new records are modified or added. This tutorial guides you through using Platform Events, a Trigger Flow, and a Screen Flow to make it happen.
System Mode
System Mode ensures that guest users can see all the data they're supposed to in your embedded flows. This is important because, without System Mode, guest users might have limited access due to their permissions. By enabling System Mode, the query bypasses user-specific permissions and fetches data based on the permissions of the Salesforce system user.
Note: While System Mode enhances data visibility, it doesn't allow guest users to edit data they wouldn't normally access. This is due to Salesforce's security practices and restrictions on data editing.
Reactive Query
Reactive Screens allow you to design interactive Salesforce interfaces that respond immediately to user actions. Combine this with Query Filters to dynamically update the data shown in your components based on user selections.
Tutorials
Troubleshooting
Have 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 the Output
Use a Display Text element to show the exact value your formula produces. This helps you understand if the formula's output suits your SOQL query. Think of it as a sneak peek into your formula's result.
Step 2: Direct SOQL Testing
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:
To use this in a SOQL query, you'd modify it to:
SQL
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 query works fine and the Display Text output looks correct, but your Avonni component filters still don't behave as expected, a more nuanced issue might be at play. In this case, please don't hesitate to contact our support team for assistance. We're here to help!
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.
Last updated