External Orders Table
Before you start
This use case requires External Objects configured in Salesforce. Review the Prerequisite section before building
Learning focus points
Querying External Objects in Avonni Dynamic Components
Building a reactive master-detail layout with two Data Tables
In this guide, you'll build a component that displays an account's external orders — data stored outside Salesforce on Heroku — directly on the Account record page. A second Data Table appears automatically when a rep selects an order row, displaying the related line items for that order.
Set up
Prerequisite
Before building in Avonni, you need two External Objects synced to Salesforce via Salesforce Connect.
External data source
Name = OrderDB
Type = Salesforce Connect: OData 2.0
External Objects and fields
Order (Order__x)
Name
Type
customerID__c
Indirect Lookup(Account)
DisplayUrl
URL(1000)
ExternalId
External Lookup
orderDate__c
Date/Time
orderID__c
Number(18, 0)
shippedDate__c
Date/Time
OrderDetails (OrderDetail__x)
Name
DisplayUrl
URL(1000)
ExternalId
External Lookup
orderID__c
External Lookup(Order)
orderLine__c
Number(18, 0)
product__c
Text(255)
quantity__c
Number(18, 0)
unitPrice__c
Number(10, 8)
Component Setup
You'll build a single dynamic component with two Data Tables arranged side by side. The first table lists orders for the current account. The second table reacts to the selected row and shows its line items.
Configure the Orders data table
Drag a data table into the left column
Name = Datatable_ExtOrders. Use a clear name as it will be used to make the other components reactive.
Create a query on the Order__x external object
Set the filter to a custom text formula resource :
F_QueryOrdersValue :
"customerID__r.Id = '" & {!$Component.RecordId} & "' "This will be read by the component as the criteria after the WHERE of the SOQL query
This is necessary due to technical limitations around external object fields
Map fields to columns according to business needs
Set the maximum selectable rows to 1
Customize the table's header
Title = External Orders
Icon =
standard:work_order
Configure the related Order Details data table
Create a query on the OrderDetail__x external object
Set a filter to
OrderID=Datatable_ExtOrders > First Selected Row SObject > ExternalId. This will make the component reactive to the selected record in the first data table.Map fields to columns according to business needs
Hide the checkbox column
Customize the table's header
Title =
Order DetailsIcon =
standard:work_order_item
Set a conditional visibility rule so that the table only display when the user selects a record
Datatable_ExtOrders>Selected Rows Key value= is not empty
Add an Image component as a placeholder
Enable show placeholder
Placeholder message : Select an order to view products.
Placeholder illustration : Gone fishing
Set a conditional visibility rule so that the image only display no order records are selected
Datatable_ExtOrders > Selected Rows Key value= is empty
Test the Component
Open any Account record that has external orders.
The Orders table should load automatically and display the account's orders.
Click any row. The Order Details table on the right should update immediately with that order's line items.
If no orders appear, verify the
customerID__cIndirect Lookup field maps correctly to the Account's Id and that the External Data Source sync is complete.
Going further
Add a Metric component above the Orders table to show the total number of open orders using a Formula resource.
Wire an Interaction on the Orders table row click to navigate to the order's
DisplayUrlif your team needs to access the source system directly.Apply Conditional Styling to flag orders where
shippedDate__cis null as "Pending".
Dynamic components used in this use case
Last updated
Was this helpful?
