Update Record using Flow Builder in Salesforce
To create or update records in Salesforce you no longer need to write a Lightning component, you can make use of Lightning Flow Builder where you can create any requirement just by clicks. Mastering flows can reduce the usage of code by 70-80%, and you don't have to write any test classes for what you build. Flows come with a component visibility option with which you can show/hide flow components conditionally.
Let’s create a flow to update and view a Contact record
Flow Elements Required
- Get Records Element
- Screen Element
- Update Records Element
Flow Variables Required
- recordId (Text)
- accountLookupId (Text)
- varContactRecordValues (Record)
All Resources Used
Get Records Element
Get Records Element is used to find and get the records from the Salesforce database. In this case, we will use Get Records Element to get the record using record Id, for this, we need to create a variable named “recordId” and allow it for input and use this record Id to filter the contacts and get the contact record.
There are a lot of screen components available. In this case drag and drop Name (for “First Name and Last Name”) and Lookup (lookup tp Account) components with configuration mentioned in the below images.
Update Records Element
Filter the contact you want to update using record Id variable and set Field values for the Contact Records with field mapping.
Add Flow Component to Record Page
Drag and drop Lightning flow to the record page with following configuration.
Live Flow Component
Enjoy the live easy made flow component to edit and view contact record.
Write to me how you feel about new Lightning Flow Builder and how it made your life easier.