Skip to Content
Knowledge is Power, so learn 🎉
Tutorial13 03 2025Servicenow Workflow Automation Tutorial

ServiceNow Workflow Automation: From Chaos to Control in 5 Easy Steps

Is your ServiceNow environment a landscape of manual tasks, email chains, and inconsistent processes? Are you tired of firefighting and ready to build a smoother, more efficient workflow? If so, you’ve come to the right place! This guide will walk you through the basics of ServiceNow Workflow Automation in five easy steps, transforming your chaotic environment into one of controlled efficiency.

What is ServiceNow Workflow Automation?

At its core, ServiceNow Workflow Automation lets you automate repetitive tasks and processes within your ServiceNow instance. Imagine automatically routing incidents to the right team, triggering approvals for change requests, or provisioning new user accounts without any manual intervention. This not only saves time but also reduces errors, improves consistency, and frees up your team to focus on more strategic initiatives.

Why Automate with ServiceNow Workflow?

  • Increased Efficiency: Automate repetitive tasks, freeing up your team’s time.
  • Reduced Errors: Standardize processes to minimize human error.
  • Improved Consistency: Ensure consistent service delivery across your organization.
  • Faster Resolution Times: Route incidents and requests quickly and efficiently.
  • Better Visibility: Gain real-time insights into process performance.
  • Cost Savings: Reduce manual effort and operational costs.

Let’s get started! Here are 5 easy steps to begin your ServiceNow workflow journey:

Step 1: Understanding the Workflow Editor

The heart of ServiceNow Workflow Automation is the Workflow Editor. Think of it as your digital canvas for designing automated processes.

  • Accessing the Workflow Editor: Navigate to Workflow > Workflow Editor.
  • The Interface: The editor is divided into key areas:
    • Canvas: The main area where you visually build your workflow.
    • Palette: Contains a library of Activities (the building blocks of your workflow, such as approvals, notifications, and tasks).
    • Properties Panel: Allows you to configure the details of selected activities.
    • Context Menu: Provides additional options for managing your workflow.
  • Key Terminology:
    • Activity: A single, defined step in a workflow (e.g., “Create Task,” “Send Email”).
    • Transition: The path that a workflow takes from one activity to another, often based on conditions.
    • Condition: A rule that determines which transition a workflow should follow.
    • Variable: A container for storing data that can be used throughout the workflow.
    • Context: Holds the execution information for a particular workflow instance (running workflow).

Step 2: Creating Your First Workflow - A Simple Incident Assignment

Let’s create a basic workflow that automatically assigns new incidents to the Service Desk group.

  1. Create a New Workflow: In the Workflow Editor, click the “New Workflow” button.

    • Fill in the form:
      • Name: Incident Assignment
      • Table: Incident [incident]
      • If condition matches: Leave this blank for now. We’ll trigger the workflow on all new incidents to keep it simple.
    • Click “Submit”.
  2. Add a “Set Values” Activity:

    • Drag the “Set Values” activity from the palette onto the canvas.
    • Double-click the activity to open its properties.
    • Name: Set Assignment Group
    • Table: Incident
    • Values:
      • assignment_group: Select “Service Desk” (or your equivalent group).
    • Click “Submit”.
  3. Connect the Dots:

    • Drag the end of the “Begin” activity and connect it to the top of the “Set Assignment Group” activity.
    • Drag the bottom of the “Set Assignment Group” activity and connect it to the “End” activity.
  4. Publish the Workflow: Click the “Publish” button.

Code Example (Conceptual representation of the “Set Values” activity):

//This is NOT actual ServiceNow script but rather a visualization function setAssignmentGroup(incidentRecord) { incidentRecord.assignment_group = "Service Desk"; // Replace with your Group's sys_id incidentRecord.update(); } // This workflow will call the function above

Step 3: Adding a Condition - Only Assign High Priority Incidents

Now, let’s refine our workflow to only assign high priority incidents.

  1. Edit the Workflow: In the Workflow Editor, open your “Incident Assignment” workflow. If it’s published, you’ll need to check it out first.
  2. Edit the “Begin” Activity: Double-click the “Begin” activity.
  3. If condition matches:
    • Condition: incident.priority == 1 (1 usually represents High priority)
    • Click “Update”.
  4. Add an “End” Activity (for No Match): Drag another “End” activity onto the canvas.
  5. Create a Transition: Drag the arrow from the “Begin” activity to the “Set Assignment Group” activity. ServiceNow will likely create a ‘Yes’ transition automatically.
  6. Create another Transition: Drag the arrow from the “Begin” activity to the new “End” activity. ServiceNow will create a ‘No’ transition automatically. If not, then edit the transitions from the “Begin” activity and select the right conditions.

Now, the workflow only assigns incidents to the Service Desk if their priority is high. Otherwise, it ends.

Step 4: Incorporating Approvals - Change Request Example

Workflows are excellent for managing approvals. Let’s create a simplified Change Request approval workflow.

  1. Create a New Workflow:

    • Name: Change Request Approval
    • Table: Change Request [change_request]
    • If condition matches: change_request.risk == 'High' (Approve only high risk change requests)
    • Click “Submit”.
  2. Add an “Approval - User” Activity:

    • Drag the “Approval - User” activity onto the canvas.
    • Double-click to configure:
      • Name: Manager Approval
      • Users: javascript: gs.getUser().getManagerID(); (This dynamically gets the manager of the user submitting the Change Request)
      • Click “Submit”.
  3. Connect the Dots: Connect “Begin” to “Manager Approval” and “Manager Approval” to “End.”

  4. Add a “Run Script” Activity for Approved and Rejected:

    • Drag two “Run Script” activities onto the canvas.
      • Name one ‘Approved Script’ and the other ‘Rejected Script’
      • In Approved Script enter the script:
//This is service side script in ServiceNow (function execute(inputs, outputs) { // Access the change request record using workflow.scratchpad var gr = new GlideRecord('change_request'); gr.get(current.sys_id); //Current refers to the Change Request record //Update the change request state gr.setValue('state', 'scheduled'); //Assuming 'scheduled' is a state you want gr.update(); })(inputs, outputs);
* In Rejected Script enter the script:
//This is service side script in ServiceNow (function execute(inputs, outputs) { // Access the change request record using workflow.scratchpad var gr = new GlideRecord('change_request'); gr.get(current.sys_id); //Current refers to the Change Request record //Update the change request state gr.setValue('state', 'rejected'); //Assuming 'rejected' is a state you want gr.update(); })(inputs, outputs);
  1. Connect the dots!

    • Create Transitions (edit transitions to specify the conditions):
      • Begin -> Approval - User
      • Approval - User -> Approved Script (Condition: answer == ‘approved’)
      • Approval - User -> Rejected Script (Condition: answer == ‘rejected’)
      • Approved Script -> End
      • Rejected Script -> End
  2. Publish the workflow.

Step 5: Monitoring and Troubleshooting

  • Workflow Contexts: To see running workflows and their status, go to Workflow > Workflow Contexts. This shows each instance of a workflow, its current activity, and any errors that have occurred.
  • Logs: Each activity can generate logs. Check the logs for detailed information about activity execution.
  • Debugging: Use the Workflow Editor’s built-in debugging tools to step through your workflow and identify issues.

Common Troubleshooting Tips:

  • Permissions: Ensure the workflow runs under a user with the necessary permissions to perform the activities.
  • Conditions: Double-check the logic of your conditions. A simple typo can prevent a workflow from executing correctly.
  • Variables: Verify that variables are being populated correctly and that they contain the expected values.
  • Scripts: Test your scripts thoroughly. Use gs.log() to write debugging information to the ServiceNow system logs.

Conclusion

You’ve now taken your first steps in ServiceNow Workflow Automation! You’ve learned about the Workflow Editor, created simple workflows for incident assignment and change request approval, and explored basic troubleshooting techniques. Remember to start small, experiment, and gradually expand your automation efforts. As you gain experience, you’ll unlock the full potential of ServiceNow Workflow Automation and transform your chaotic processes into a well-oiled machine. Good luck!

Last updated on