logo

NJP

Flows Best Practices General - Workflow Automation CoE

Import · Oct 24, 2022 · article

Workflow Automation CoE > Flows > Best Practices > General

Flows Best Practices

Application Scope

  • Create Flows and Actions in a scoped application.
  • Use ServiceNow source control integration with Git for versioning, forking and branching of your flows.
  • Application names should not include version as part of the name.

Guidelines for creating flows

  • Add annotations to provide context, when action titles are insufficient
    • Flow Annotations are generally used by a developer to provide context when authoring a flow. Annotations on an action are optional. Only use annotations if the flow step needs extra description e.g. do not have annotation that repeats what the action name or subflow e.g. My Action is Create User, an Annotation that says, "This action will create a user" has negative value and creates noise on the flow.
  • Add a log step for each possible branch of the flow to assist in debugging or triage.
  • Limit inline scripting use to field formatting and field validation.
  • Use conditions in trigger to pull a smaller set of records.
  • Only trigger flows when required.
  • Flow Variables.
    • Similar to Workflow scratchpad variables, create variables that you can use and modify directly in your flow. Access flow variables as data pills directly in the Data panel.
    • Use flow variables to store data and pass it between outside of branching logic.
    • Flow variables are mutable, where subflow and action inputs and outputs are immutable. That is, Flow Variables can change through the life of the flow, where-as inputs/outputs cannot. Subflow and Action inputs/outputs are configured and set at point in time during the flow, and cannot be changed.

Subflows

  • Flows should be short, modular reusable. Use subflows as reusable automation, just like actions.
    • Consider actions as single purpose atomic events, where-as subflows are composite logic made of up actions, logic and other subflows.
  • Consider using subflows for portions of your logic, when the flow exceeds 25 actions.
  • Note: You can use triggered flows as subflows. To see the triggered flows in your subflow picker, enable the "show triggered flows" in the flow preferences dialog.

Naming convention

  • Include a Description for your Flow.
  • Use human readable names for Flow Name, Subflow Inputs and Subflow Outputs.
  • All Input/Output labels use Camel Case with spaces.
  • Categorize your Flows and Subflows when the application scope includes more than a few Flows and Subflows.
    • Categorized Flows and Subflows appear in the Subflow picker menu
    • Note: to show Triggered flows in your Subflow picker, enable the Flow preference "Show Triggered Flows" toggle preference.

Decisions

Notifications

  • When sending emails from a flow, choose the “Send notification” action over the (legacy) “Send email” action. System notifications need to be set to “Send when = Triggered” to show up in Flow Designer. This allows you to benefit from:

Center of Excellence Navigation

Labels:

View original source

https://www.servicenow.com/community/workflow-automation-articles/flow-designer-best-practices-general-workflow-automation-coe/ta-p/2359985