Inspiration from TDX: Using Custom Metadata Types to Bypass Actions in Flow
I recently attended Salesforce’s TrailblazerDX conference in San Francisco, CA. With 300+ technical sessions and hands-on workshops, I had some tough decisions to make on which sessions to attend, but a hands-on session called "Enhance Record-Triggered Flows with Custom Metadata Types" was one of the most practical ones I chose.
What are Custom Metadata Types?
According to Salesforce Help, custom metadata is customizable, deployable, packageable, and upgradeable application metadata. First, you create a custom metadata type, which defines the form of the application metadata. Then you build reusable functionality that determines the behavior based on metadata of that type.
For example, you can create associations between different objects, such as a custom metadata type that assigns cities, states, or provinces to particular regions in a country. Another use case would be managing lists, such as approved donors and pre-approved vendors. This is the example we’ll utilize.
How to use Custom Metadata Types in Flow
Imagine you work at a nonprofit and you want to automatically send event attendees a follow-up email asking them to donate, but you don’t want that email to go out to current board members. We can utilize custom metadata types to enable or disable a checkbox indicating whether we want board members to be bypassed when a record-triggered flow sends an email to attendees post-event.
1. Create the Custom Metadata Type (in the example below I called mine “Trigger Configuration,” as well as custom fields, and records that indicate whether to enable or disable if the Contact is a board member.
Example record:
2. Create an autolaunched flow. The autolaunched flow will check the value of “IsEnabled” in the custom metadata type.
3. Add the autolaunched flow as a subflow element in your record-triggered flow. Your record triggered flow should contain a decision after the subflow with two outcome paths. One path completes the given action and the other bypasses the action and ends the flow.
Edit Bypass Criteria Without Changing the Flows
Fast forward a few months to your next event, and say you want all event attendees to receive the post-event email, even board members. Do you have to edit these flows or start all over? Nope! Simply edit the IsEnabled value in your Custom Metadata Type.
How would you utilize custom metadata in flow? Let me know on the Salesforce Trailblazer Community, or tweet directly at me on Linkedin or X (formerly known as Twitter) @beckymikos.