5 Flow Designer Best Practices You Should Follow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2022 08:12 AM
After implementing 174 productive flows, subflows and actions in ServiceNow Flow Designer, I want to share my personal best practices. My goal is to help others save a lot of time and avoid making the same mistakes. Disclaimer: The recommendations are based on my personal experiences and are not official ServiceNow best practices. I am happy to discuss the mentioned points with you in the comments and learn about your personal best practices.
1. Avoid Scripted Inputs at All Costs
Passing inputs to a subflow or action via script can be considered hard coding and will lead to issues if the order of actions later changes or additional actions are added. A better approach would be to drag and drop the required data from the data pill. In this case, Flow Designer will automatically ensure that the value is still referenced correctly, if the order of action changes.
Bad Practice: Accessing data from the previous step via script
Good Practice: Drag and drop the required data from the data pill
2. Categorize Everything (Flows, Subflows and Actions)
Flows, subflows and actions are not bound to one specific table, which makes it difficult to find and maintain them (in contrast to Business Rules, Client Scripts etc.). Therefore, each flow, subflow and action should be categorized as shown in the following screenshot. Add new Categories by creating records in the table “sys_hub_category”.
Good Practice: Set a category in the flow, subflow and action properties view
3. Use Decision Tables
In case of complex flows, avoid using multiple if/else branches and use a decision table instead. The decision table provides an intuitive overview in one place that can even be extended by people who do not know how to code or don’t have access to Flow Designer.
Bad Practice: Create an own if branch for each partner level
Good Practice: Create an intuitive decision table and use the “Make a decision” action
4. Combine Actions in Subflows
Combine logically connected actions in a subflow and build a flow of subflows. Those subflows can be reused across multiple flows saving time during initial creation, as well as maintenance. Furthermore, outsourcing actions into subflows allows implementing complex flows while sticking to the 50-step limit in flows.
Bad Practice: All actions are created directly in the flow
Good Practice: The flow contains a subflow which contains the individual actions
5. Minimize Subflow Inputs
Pass one reference variable to a subflow instead of each required value individually. With dot walking the subflow can then access any variable on the referenced table. If additional fields from the table are required by the subflow, all configurations can be done on subflow level without having to touch the flow.
Bad Practice: Pass each variable individually to the subflow
Good Practice: Pass a reference variable and access individual variables via dot walking in the subflow
- 2,917 Views