Editing Records In Real Time
With the ultimate version of Flow Data Table, it is possible to edit records in the data table and save them to your Salesforce Org in real time with validation rules enforced.
In this guide, we will extend the flow from the getting started guide to enable real time database editing and demonstrate how the table enforces validation rules.
Creating The Validation Rule
Lets create the validation rule first. Under setup:
- Go to Object Manager
- Click Account
- Click Validation Rules
- Click New
- Fill out the Account Validation Rule form as follows:
Rule Name: citynameuppercase_first
Description: Ensure the first character of billing city is uppercase.
Error Condition Formula: LOWER(LEFT( BillingCity, 1)) = LEFT( BillingCity, 1)
Error Message: Please ensure the first character of the billing city is uppercase. - Ensure your validation rule form looks like the screenshot below and click Save
Updating The Flow
Now that the validation rule is added, lets update the flow to enable real time editing. Under setup:
- Type Flows in the quick find box
- Click Flows
- Click Open on the Accounts flow that was built in the getting started guide
- Double click on the Accounts Table element
- Select the AccountsTableCmp component
- In the right pane, scroll down to Table Mode and select Database Editing
- Click Done
- Save the flow
- Run the flow
- Name one of the Billing Cities Chicago and another baltimore
- Click Save
The table should save the billing city set to Chicago in the database. However, the billing city set to baltimore should not have been saved and an error message should be shown.
- Change baltimore to Baltimore
- Click Save
The error message should be removed from the table. You can open up another tab and navigate to the account detail pages to verify the records have been updated and match the data table field values.