Flow 101 - 3 Essential Flow Tips for the Salesforce Admin
At our most recent Lunch and Learn, we demonstrated Flow fundamentals that are great to keep in your admin toolbox. And as a result of the session, over 10,000 meals will be provided to people in need.
We donated to Feeding America for each attendee; each donation provides multiple meals, and we had a lot of attendees! Learning while contributing to the communal good is a fundamental part of the Salesforce Ohana culture, and thank you to everyone who attended and asked questions.
In our Lunch and Learn we looked at 4 Flows we think every Salesforce Admin needs to know. We also created a step-by-step blog post guide with the full recording of this demo session embedded in at the end. Today’s blog will provide a recap of the techniques we used to build our demonstration flows.
These are not complex or particularly difficult but are effective techniques utilized for declarative automation in a wide array of business use cases.
Remember, the two primary building blocks to Flows are Elements and Resources.
Elements are the actions that a flow can execute. There are many different elements within flow builder, and functionality extends from searching for and updating records to serving end-users with customized screens or sending emails.
- Resources are used throughout the flow to help steer the logic of how elements are utilized. For instance, a Text Template resource can be used as the body of an email message, while a Formula could be used to update a record with a standardized name. In our example last week, we used an Update Records element with a formula resource to standardize Opportunity names.
- Resources can be created by the user or by the system. When a Get Records element is utilized, the record field values are stored as a resource that can be used in other elements and resources.
- Some resources are variables, which means their value may change throughout the flow.
How-to Tip #1: Access Field Values on the Record that Fired the Flow
When using a flow that is triggered by record creation or deletion, the record that caused the flow to fire has field values and values of parent objects stored in the $Record global resource. This system resource allows flow creators to quickly use the record values in elements throughout the flow.
In this screenshot example, the record type is being used in a decision element. If the record type ID of the triggering record {!$Record.RecordTypeID} is equal to the record type ID I have stored in a constant resource (remember to avoid hard-coding IDs), the flow will continue along that outcome path. In this example, the flow is determining if the record type of the opportunity is Big Deal or not. If it is, elements later in the flow send alert emails to stakeholders.
How-to Tip #2: Pass a Record ID into a Screen-Launched Flow
In our 4 Flows Lunch and Learn, we looked at how screen flows can be used to launch surveys and delete records with the click of a button. Screens launched flows are often used to update a record (or associated records) that the user is currently viewing with the click of a button.
In order to achieve that functionality, the flow needs the ID of the record that the flow is launched from. By creating a text variable resource named “recordId” (case-sensitive), Salesforce automatically passes the record ID of the record that the user is viewing when they launch the flow.
Once the flow has that value, it can be used to find the source record’s record and child records and reference their values, make updates to the records, or even delete the records entirely. The screen launched flow could even be used to create new records and then associate them with the source record - all with the help of our handy recordId variable.
How-to Tip #3: Set Relative Dates in Schedule Triggered Flows
Schedule-triggered flows have three options for frequency: weekly, daily, or once. Similar to other auto launched flows, conditions can be set to ensure that the only records processed by the flow meet certain criteria.
One limitation of flow is that relative dates can not be used with date fields in flow start conditions. There is some indication that this feature will come someday, but until that day arrives a workaround needs to be used. And that requires us to step outside of flow entirely to create the relative date field on the record itself in the form of a checkbox formula field.
After the relative date checkbox formula field is created, we can now use it as condition criteria in our schedule-triggered flow. In this instance, only opportunity records that closed between 15 and 59 days in the past are processed by the flow.
Check out the recording of the Lunch and Learn here and dive into building Flows.
If you enjoyed reading, make sure to take a look at Mario Di Genio’s recent blog on building maintainable flows, and check out the guide with the Lunch & Learn recording of "4 Flows Every Admin Needs to Know". For more Salesforce tips and updates be sure to follow Arkus @arkusinc on Twitter. Questions for me about flows? Find me on LinkedIn.