Before Save Flow Example In Salesforce

Telegram logo Join our Telegram Channel

Before-Save flows are the record-triggered flows executed before saving the records into the database much like the before triggers in Salesforce. In this post, I will show you how to create a simple before-save flow on the standard order object in Salesforce.

Create before save flow - Step by Step - Salesforce


Use Case

The business has a requirement to copy the Account's Billing Address and Shipping Address automatically on creating and updating an order.


Step by Step Flow Solution

  1. Go to setup and search for flows.
  2. Open the Flows page and click New Flow.
  3. Select the Record-Triggered Flow option and click create.
  4. Select the Object and select the trigger event A record is created or updated like below:
    New Order Flow on create and update

  5. Now scroll down further on the same page and in the Set Entry Conditions section select the Fast Field Update option to run the flows before saving the record. Like below:
    Select flow trigger criteria

  6. Additionally, you can select entry conditions for flow like the record is new or some fields are changed. I added conditions in order to check if the record is new or if the account is changed on the order.

  7. Now it's time to set field values using the assignment flow element, so click Done from the bottom right corner and you will see the flow builder. Click the + button to add a new element and select Assignment, it will open the New Assignment page.

  8. On the New Assignment page, give the label and name, and description to it. Like below:
    Create assignment element in flow

  9. In the Set Variable Values section search for record in the Variable input box to select the current record from the flow, which is Order. Then click the right arrow to see the fields and search for the field you want to set the value to.

    After that select the record -> Account -> account field name from in the value input box like below:

  10. For additional fields click add Add Assigment button and set the field values. 
  11. This is how it looks after adding assignments for all Billing Address fields.


  12. After adding all your requirement assignments click done.
  13. Save and Activate your flow.
  14. Time to test your flow. 
  15. Create a new order under an account to see if all assigned field values are populated.
  16. Debug your flow if any issues.
I hope this was helpful! Let me know in the comments if any questions! Thanks for reading this post!

No comments :
Post a Comment

Hi there, comments on this site are moderated, you might need to wait until your comment is published. Spam and promotions will be deleted. Sorry for the inconvenience but we have moderated the comments for the safety of this website users. If you have any concern, or if you are not able to comment for some reason, email us at rahul@forcetrails.com