Summer ’20: A new way to “write” a before trigger using a before-save flow

Before triggers are typically written to access / update a record before it’s actually saved as a record. This ability was only possibly by writing apex code as any other declarative method of updating a Salesforce record occurs after it’s committed to the database. Summer ’20 has brought us a new way to utilize the Salesforce flow builder and it’s called a “record-changed” flow. Not only can record-changed flows be likely an entire replacement for the process builder but the functionality of a before-save flow gives the ability to query and modify its data, just like a trigger or trigger handler could.

I came up with a quick concept where say you had records coming in from an external entity (perhaps a web to lead form), you could bypass a validation rule that should’ve only been triggered for UI based data entry by using a before-save flow. It clearly wasn’t fully thought through as my example bypasses the validation rule through UI as well, but let’s just say that the records from the external entity would also check off a hidden boolean that would also be included in the validation rule criteria. You get the point.

You can read Salesforce’s info on before save flows here.

Leave a Reply

Your email address will not be published. Required fields are marked *