Lightning Flow now is the hottest tool from Salesforce, which is a Flow builder, but Flash-less. Salesforce developers need to have a fair understanding of the Flow in order to take the best advantage of it. For those who are new to it, the primary thing to know is that Flow is placed between the Process Builder and Apex in terms of complexity and also in terms of power.
There are many ways to learn more about the Flow, including Salesforce Trailheads. The official admin portal of Salesforce also published a set of Flow builder tutorials by experts, which can be accessed by the beginners to get an overview. Here in this article, we will discuss a few essential things you need to know about Flow and its features.
To start with, one should remember the fact that Flow can be launched only through.
• Apex trigger
• Process builder
• Button on the page layout
• Embedded in Lightning Component / Lightning Community/
• Embedded into Lightning records page etc.
Lightning flow tips
1. Documenting in detail
In terms of programming, it is essential to comment and format the code properly. Provided this, you can get admired even if the initial set of code is poor. Adequately putting the comments or breadcrumbs on your code for other developers who are working on it further to inherit the work properly. This same rule is also applicable to any solutions which are configuration based.
# Flow description
Always make sure that you include what all things Flow do and also the objects which Flow touches in the course of development. It is essential to mention where all these are invoked from like which page used in the screen Flow, the process builder used in the Flow, which is auto-launched, etc.
# Naming conventions for elements and variables
Similar to the standard followed in programming, it is also essential to stick to appropriate naming conventions while preparing elements or creating variables in the Flow. You need to specify all the variable descriptions, too, as to what you capture. This ways, putting a little extra effort up front can take you a long way further to help yourself or someone else who inherits the Flow. In fact, there are no standard ways to do it; one should simply ensure to keep this consistent in the Flow.
Also Read: How to Start Your Career in Cyber Security
Some examples of naming conventions are:
# Description of steps
It is advised to write short blurbs on each step and also mentions why you are doing this. Such steps as initiated by providers like Flosum.com will further help you to remember while you reconsider it after many days or months or when another person is accessing it to readjust it.
2. Screen Flow and Auto-launch Flow
While designing screen Flow, always keep in mind that a proper screen flow will always operate using permissions of those who run it. As the developers update a field or looking for a particular record in the Flow, make sure that the target audience is having access to everything that a Flow does or otherwise you may start to get some errors.
On the other hand, if the need is to have a screen-based Flow which could bypass any user permission, you have to sit with a developer to prepare some Lightning components embedded or the Apex actions to be clubbed in the Flow. However, we can expect Salesforce itself may add this feature in the future. If you are trying to create an auto-launch Flow from the Process Builder itself without any screens, then there is no need for permission as this may run under system context, which has full access.
3. Using debugger
Salesforce released a tool for Flow debugging recently with which the developers can avoid the additional steps to save each version in order to test the Flow. Even though it sounds a bit strange, there is no need to get intimidated as it is super-easy to use. You can simply save the Flow and then press the Debug button.
With this, you can enter the values for any variables. However, testing the Flow could run any DML operations along with the Flow. So, even if you are testing it to see how it is working, the Flow will be run. Another limitation is that you cannot set the values into the collection variables, objects, etc. You cannot also set ‘running users’ in the Flow, so on using the formula variables, you may also have to activate the Flow as well as to log in as a different user to test it.
4. Maintain a fault path on Create, Update, Delete, or Lookup of elements
On checking the Flow, we can find that the major mistake the beginner Flowmasters tend to make to skip building Fault paths. Ideally, a fault path with help to handle it well when there is an error encountered by the Flow. It will describe what you have to do at those times. The common uses of it are to show the errors screen for the screen-based Flows or to take actions like sending mail alert with the errors message to the development team etc. For creation of fault path, you may connect one element to the very next element in the Flow and drag a line from that element to the fault action.
5. Having a decision with Get and Lookup elements
While putting a ‘Get’ or a ‘Lookup’ into the Flow, always make sure that you have a checkbox that specifies “Assign the null values to variable/s if there is no record found.” In many cases, the Lookup may not find a record, so there should be a proper plan for it in the Flow. Immediately after Lookup, always include a decision check to Null in variables you assign in ‘Get’.
6. Using the subFlows and custom labels
Doing it will help save a lot of time.Most of the developers don’t know that they can call one Flow right from another. However, once done so, it will help to avoid the clutter in the Flow. You can re-use the other Flows too by calling them from within a Flow. To do this, all you have to do is to drag in the Subflow from the action panel simply.
Hope these tips are helpful and Flow is one thing which admins also need to learn to level up their skills and get a deeper understanding of the inner works of Salesforce. Even though it still has many limitations, the providers keep on putting more and more resources into the Lightning Flow in order to make it better day by day.
Also Read : 20 Most Amazing SolarMovie Alternatives in 2019