This article is a supplement to the ServiceNow documentation. For full documentation please refer ServiceNow official website
Checkout our NEW Video Channel you can like and subscribe too!

Introduction

Workflows in ServiceNow are flowchart-driven automation tools with a drag-and-drop interface. Workflows can be used to automate multi-step processes using various tools, including approvals, child-task generation, notifications, logical loops and scripting, if/then control flow, timers and they can even wait for and react to user activity.

Workflow essentials

  • Each workflow comprises one or more activities, which are executed in sequence, beginning from the Begin activity and ending when it reaches the End activity.
  • A workflow usually executes when a record in the table it is attached to is either inserted or updated and the start condition defined in the workflow properties evaluates to true.
  • Workflows can also be executed based on an event or from scripts.
  • Workflow editor can be used to design, modify, and validate the workflows.
  • Workflow editor is a graphical tool that is used to design workflows by arranging and connecting activities to automate a process.
  • Each activity in a workflow has its own variable scope and can output objects that can be used by subsequent activities.
  • Activities defined within a workflow can also access workflow-level variables referred to as workflow scratchpad variables.
  • A workflow executes only when it is in published state.
  • A workflow executes only when it is in published state. We can publish a workflow using the Publish option in the actions menu.
  • The status of the workflow is always visible in the title bar.
  • If a workflow is in published state, we cannot modify its properties or make any changes to any of its activities.
  • Incident, change, problem, service-level management, and service catalog, rely heavily on workflows.
  • If there are multiple workflows defined in a table, we can specify the order in which workflows are executed.

Workflow key properties

Below are the properties can be configured when defining a workflow

Name: A unique name for the workflow that can be used to distinguish it from other workflows.

Table: Name of the table on which the workflow will be applied.

If condition matches: This property can be used to define when and how the workflow will execute. There are three possible options:

Run the workflow: If this option is selected, the workflow will execute when the workflow’s condition field evaluates to true.

Run if no other workflows matched yet: If this option is selected, the workflow will execute when the workflow’s condition field evaluates to true and no other workflows are running on the record.

None: This option can be used to ignore the condition filed and use a subflow or script to execute the Workflow

workflow130102019.PNG

Workflow workflow230102019.PNG

Workflow actions menu

The workflow actions menu, as shown in the following screenshot, in the title bar of the canvas, can be used to perform many different actions related to the current workflow. It can be used to publish, copy, or delete the workflow. It can also be used to validate the workflow and access workflow contexts that are currently associated to any record.

workflow330102019.PNG

Workflow properties

We can modify properties of any checked-out workflow at any time. We can open the Workflow Properties dialog using the Properties option in the action menu in the title bar.

workflow430102019.PNG

Verision: Versions of each workflow are stored in the Workflow Versions [wf_workflow_version] table.

Context: When a task matches the criteria set up for a workflow, that workflow will execute against that task, and perform activities on it. This relationship between one workflow version and one task, is called a Context. Contexts are stored in the Workflow Context [wf_context] table.

Important workflow activities

wf281120191.PNG

Join activity

workflow530102019.PNG

An activity can also have multiple lines drawn from a single exit condition, pointing to multiple activities. If this is the case, these activities will execute simultaneously.

In a situation like this, it’s possible to save a workflow where one of these branches doesn’t have an exit condition (a transition to another activity), but it isn’t recommended. Instead, ServiceNow provides a Join activity, which you can use to merge the divergent paths back into a single transition-flow.

Switch

An If condition activity is perfect in the event that there are only two exit states: true and false, or yes and no. If you want your workflow to follow a separate path based on a particular field’s value, such as the impact of a given ticket, you might find it more advantageous or convenient to use a Switch. A Switch pivots off a field’s potential values, and works especially well with drop-down fields that have a fixed number of potential values:

workflow630102019.PNG

    Content