LogoLogo
HomepageYouTube ChannelInstall from the AppExchange
  • Home
  • Dynamic Components
  • Flow Components
  • Experience Components
  • Projects
  • 👋Welcome
  • Getting Started
    • Product Tour
    • Quickstart Tutorial
    • Understanding The Essentials
      • Component Builder
      • Component Visibility
      • Target Page Object
      • Using Variables and Component Data
      • Publishing your Dynamic Components
      • Dynamic vs. Flow Components
    • Avonni Components App
      • Accessing the App
      • Folders
      • Templates
      • Version management
    • AppExchange Listing Page
    • Installation & Licenses Management
  • Tutorials
    • Projects
    • Components
      • Calendar
        • How to Create Events Quickly by Dragging
        • How to Add an Edit Action to Calendar Events
        • How to Add a New Event Button to the Calendar Header
        • How to Customize the Right-Click Menu
        • How to Reschedule Events with Drag and Drop
      • Columns
        • Creating a Responsive 3-Column Layout
      • Data Table
        • How to customize Data Table style
        • How to make a field editable
        • How to add clickable buttons
        • How to color-code badges
        • How to export data
        • How to configure search
        • How to set columns visibility
      • Kanban
        • Saving Changes on Drag-and-Drop
      • List
      • Metric
      • Record Detail
        • Saving Changes
    • Interactions
      • How to create an interaction to navigate to an object page
      • How to create an interaction to navigate to a record page
      • How to Pass Multiple Selected Records from a Dynamic Component to a Screen Flow
    • Reactive Components
      • Reactive Map and Data Table
      • Master-Detail Relationship with Data Tables
      • Vertical Tabs with Reactive Data Table
    • Style
      • How do you add space or a break between sections or fields?
    • Tips and Tricks
      • Using the Dynamic Component component
  • Component Builder
    • Overview
    • Configuring Components
      • Properties
      • Fields
      • Style
    • Data & Interactions
      • Data Sources
        • Manual
        • Picklist
      • Resources
        • Constant
        • Formula
        • Nested Queries
        • Query
        • Variable
      • Interactions
        • CRUD from Record Variable
        • Download
        • Execute Flow
        • Navigate
        • On Load
        • Open Alert Modal
        • Open Confirm
        • Open Dynamic Component Dialog
        • Open Dynamic Component Panel
        • Open Flow Panel
        • Open Flow Dialog
        • Show Toast
    • Advanced Topics
      • Undo / Redo
      • Copy and Paste
      • Keyboard Shortcut
  • Components
    • Explore All Components
    • Accordion
    • Alert
    • Audio Player
    • Avatar
    • Avatar Group
    • Badge
    • Barcode
    • Blockquote
    • Button
    • Button Group
    • Button Icon
    • Button Menu
    • Button Stateful
    • Calendar
    • Camera 🆕
    • Card
    • Carousel
    • Chart
    • Checkbox
    • Checkbox Button
    • Chip Container
    • Color Picker
    • Columns
    • Combobox
    • Container
    • Counter
    • Data LWC Container
    • Data Table
    • Date Picker
    • Date
    • Date Range
    • Dual Listbox
    • Dynamic Component
    • Formatted Address
    • Formatted Name
    • Formatted Value
    • Header
    • Icon
    • Icon Picker
    • Illustration
    • Image
    • Input Color
    • Input Date
    • Input Pen (Signature)
    • Input Text
    • Kanban
    • List
    • LWC Container
    • Map
    • Media Object
    • Metric
    • PDF Viewer
    • Pivot Table
    • Progress Bar
    • Progress Circle
    • Progress Indicator
    • Rating
    • Record Detail
    • Relationship Graph
    • Scope Notification
    • Section
    • Separator
    • Slider
    • Status
    • Tabbed Container
    • Tabs
    • Text
    • Text Area
    • Timeline
    • Toggle
    • Tree
    • Vertical Visual Picker
    • Video Player
    • Visual Picker
    • Visual Picker Link
  • Help
    • Contact Support
    • Security
    • Performance Guide
    • Deployment Process
    • Release Notes
    • Report Bugs
Powered by GitBook
LogoLogo

Company

  • About Us
  • Pricing

Policies

  • Privacy Policy
  • Terms of Service
On this page
  • Core Concepts
  • What is a Nested Query?
  • When to Use Nested Queries
  • Managing Nested Queries
  • Creating a Nested Query
  • Editing a Nested Query
  • Configuring Nested Queries
  • Parent Query Configuration
  • Child Query Configuration
  • Example: Accounts and Contacts
  • Reactive Nested Queries

Was this helpful?

  1. Component Builder
  2. Data & Interactions
  3. Resources

Nested Queries

Last updated 10 days ago

Was this helpful?

The Avonni Nested Query Data Source allows you to retrieve hierarchical data from your Salesforce org—specifically, parent records and their related child records—in a single query. This is ideal for displaying data in components like the Avonni Tree, which requires a nested structure.

Currently, nested queries are only supported by the and components.


Core Concepts

What is a Nested Query?

A Nested Query retrieves a list of parent records and, for each parent record, also retrieves its associated child records. This creates a nested data structure reflecting your Salesforce data's parent-child relationships. This differs from a standard Query, which retrieves a flat list of records.

When to Use Nested Queries

Use Nested Queries when you need to display hierarchical data, typically in components like:

  • Avonni Tree: The primary use case, as the Tree component is designed to visualize hierarchical data.

  • Other components might benefit from displaying nested relationships in the future.


Managing Nested Queries

Important Note: Nested Query Configuration Updates

We are enhancing the configuration process for Nested Queries to make it even more straightforward. As a result, the specific steps and options described on this page may differ slightly from the latest version available in the Avonni Dynamic Components builder. This documentation will be updated shortly to reflect these improvements once fully released.

Creating a Nested Query

You can create a new Avonni Nested Query in two ways:

  • Via the Resources Button:

    1. Click the Resources button (usually located in the page editor or component panel).

    2. Select the option to create a new Nested Query Resource.

  • From an Avonni Component (e.g., Tree):

    1. Select the Avonni component (e.g., Tree) to connect to the nested query.

    2. In the component's properties panel, look for a button or link labeled "Create a Nested Query" or "New Nested Query". Click it.

Editing a Nested Query

You can modify an existing Avonni Nested Query in two ways:

  • From the Resources Menu:

    1. Click the Resources button.

    2. Locate the Nested Query you want to edit in the list of resources.

    3. Select the option to edit the Nested Query (this might be an "Edit" button, a pencil icon, or clicking the query name).

  • From an Avonni Component:

    1. Select the Avonni component (e.g., Tree) currently using the Nested Query.

    2. Find the section related to the data source or query in the component's properties panel.

    3. Look for an option to edit the Nested Query (this might be an "Edit" button, a pencil icon, or similar).

Important Note

  • Modifying an existing Nested Query will affect all Avonni components within your project using that same Nested Query.

  • Creating a New Version (Recommended): If you want to change a Nested Query without affecting other components, use the "Save As" to create a new copy of the Nested Query. Then, modify the latest copy.


Configuring Nested Queries

Configuring a Nested Query involves defining both the parent query (to retrieve the top-level records) and the child query (to retrieve the related records for each parent).

Parent Query Configuration

The parent query defines the top-level records you want to retrieve. This is similar to configuring a standard Query:

  • Object: Select the Salesforce object for the parent records (e.g., Account).

  • Fields: Choose the fields you want to retrieve from the parent object.

  • Filters (Optional): Add filters to limit the parent records retrieved (e.g., Type equals 'Customer'). You can use both static and reactive filters here.

Child Query Configuration

The child query defines how to retrieve the related records for each parent record.

  • Object: Select the Salesforce object for the child records (e.g., Contact).

  • Fields: Choose the fields you want to retrieve from the child object.

  • Relationship Field: Crucially, you'll need to specify the field on the child object that relates it to the parent object (e.g., AccountId on the Contact object). This is how the Nested Query knows which child records belong to which parent record.

  • Filters (Optional): You can add filters to refine the child records retrieved further. You can even use reactive filters here, referencing attributes of the parent record. For example, you could filter Contacts to only show those with a Status of 'Active' for each selected Account.

Example: Accounts and Contacts

To display a tree of Accounts and their related Contacts:

  1. Create a Nested Query Resource.

  2. Parent Query:

    • Object: Account

    • Fields: Id, Name (and any other Account fields you want to display)

  3. Child Query:

    • Object: Contact

    • Fields: Id, FirstName, LastName, Email

    • Relationship Field: AccountId (This links the Contact to its parent Account)

  4. Connect the Nested Query to an Avonni Tree component.

  5. Configure the Tree component to display the desired fields from parent (Account) and child (Contact) records.


Reactive Nested Queries

Nested Queries can also be reactive, just like standard Queries. This means that the data displayed can update dynamically based on user interactions or changes in other components.

  • Reactive Filters in Parent Query: You can use reactive filters to control which top-level records are displayed in the parent query.

  • Reactive Filters in Child Query: You can use reactive filters in the child query, and these filters can even reference attributes of the parent record. This allows for very dynamic and context-aware data displays. For example, you could have a dropdown that controls which type of Contacts are shown for each Account.

Avonni Tree
Avonni Relationship Graph