Before you begin building and distributing flows, understand the best practices.
Available in: both Salesforce Classic and Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions
Plan out your flow before you start building.
Write or draw out all the details of your business process. That way, you have a clear idea of what information you need, where you’re getting that information from, and what logic and actions to perform. Doing so makes building the corresponding flow much easier.
Build your flows in a test environment—like a sandbox or Developer Edition org.
The last thing you want to do is accidentally change records in your company’s production org. Build your flows in a separate environment. That way, you can enter fake data and test various permutations of your flow without worrying about changing or deleting data that your users actually need.
Never hard-code Salesforce IDs.
IDs are org-specific, so don’t hard-code new or existing IDs. Instead, let Salesforce create the IDs, and pass them into variables when the flow starts. You can do so, for example, by using merge fields in URL parameters or by using a lookup element.
Wait until the end of the flow to make changes to the database.
Have you heard about flow limits? Because flows operate under Apex governor limits, the sky is not the limit. To avoid hitting those limits, we recommend bunching all your database changes together at the end of the flow, whether those changes create, update, or delete records.
Control when running users can navigate backward.
If the flow commits changes to the database between two screens, don't let users navigate from the later screen to the previous screen. Otherwise, the flow can make duplicate changes to the database.
Provide an error handler.
Sad to say, but sometimes a flow doesn’t perform an operation that you configured it to do. Perhaps the flow is missing crucial information, or the running user doesn’t have the required permissions. By default, the flow shows an error message to the user and emails the admin who created the flow. However, you can control that behavior. See Customize What Happens When a Flow Fails for more information and recommendations.
Save early and often.
Sometimes the Cloud Flow Designer falls victim to unexpected problems, like losing Internet access. Salesforce doesn’t save your changes automatically, so it’s up to you to save your work. Save as often as possible, so that you don’t accidentally lose a few hours’ worth of work.
Test as many permutations of your flow as you possibly can.
As with all customizations in Salesforce, it’s important to test your work. This is especially true if your flow uses branching or other complex logic. Make sure that you test as many possibilities as you can think of before you distribute the flow to your users.