Update Records Order
The Update Records Order interaction persists a new display order for the records shown in a component.
Overview
The Update Records Order interaction saves a new order for one or more Salesforce records — for example, after a user drags items into a different sequence. The new positions are written back to the field your query sorts by, so the order persists across sessions and users.
Prerequisites
For this interaction to be usable, the component must meet two conditions:
Query data source: The component must use a query data source.
Sortable items: The component must offer the option to sort its items.
The records order field is the first field used in the ORDER BY clause of the component's query. When the interaction runs, that field is updated on the affected records to reflect the new order.
Configuration
Configure your component's query with the sorting field first in its ORDER BY clause (e.g., a numeric
Position__cfield).Enable the component's item sorting option.
Add the Update Records Order interaction to the sorting trigger so the new order is saved to Salesforce.
Post-Action Configuration
The interaction lets you chain follow-up interactions depending on the outcome:
On Success: The interactions to execute when the records are reordered successfully — e.g., a Show Toast (Success variant) to confirm the change, or a Refresh Query if other components display the same records.
On Error: The interactions to execute when the order update fails — e.g., a Show Toast with the "Error" variant so the user knows the new order was not saved.
Accepted follow-up interactions for both outcomes are: Show Toast, Refresh All Queries, Refresh Query, Get Record, and Assignment.
Example
Goal: Let users reorder a task list by dragging, and keep that priority order in Salesforce.
Query: The component queries Task records with
ORDER BY Priority_Order__c.Sorting: The component's item sorting option is enabled so users can rearrange items.
Interaction: Update Records Order writes the new positions to
Priority_Order__c.On Success: Show Toast ("Order saved"). On Error: Show Toast (Error variant).
Last updated
Was this helpful?
