Service Catalog and Workflow Overview


Description

In this article we'll dive into the following subjects:

ServiceNow Workflow with Service Catalog

One of the most powerful ways of automating a process is to make it available to users through the Service Catalog.

Associate a Workflow with a Service Catalog Item



  1. Service Catalog > Maintain Items.

  2. Select the K14 WF 201 Example – Request Subscription. You may need to switch to the Advanced View.
    Click on the View name to select the Advanced View.

    NOTE: The purpose of this lab is to demonstrate the association of Service Catalog and Workflow. Learning how to build Catalogs, Add Items to Catalogs etc. is a part of the Service Catalog track of this conference and is highly recommended for anyone interested in writing workflows for Service Catalog Items.Notice the Workflow field. This field creates the association between the Service Catalog Item and the Workflow assigned to this field. In this case the Workflow assigned is K14 WF 201 Example - Request Subscription. It is this field in the RITM that will be read from inside the Run Workflow Business Rule in the Gateway Approval process we discussed earlier.

  3. Scroll to the bottom of the form and find the Variables Related List. There will be 3 records.
    The variables that belong to this Catalog task are available for read and write within the K14 WF 201 Example - Request Subscription Workflow.

  4. Return the Workflow Editor in the adjacent browser tab.

  5. Click Open.

  6. Select the K14 WF 201 Example - Request Subscription.
    Your workflow should look like this:


  7. Select the Gear Menu > Check Out

  8. Select the Gear Menu > Properties


    This Workflow is written against the Request Item table. Notice that there are no conditions available for this workflow. Because the Workflow Engine doesn’t evaluate the Request Item Glide Record to determine if it should run or not, there is no point in configuring conditions.
    QUESTION: If the Workflow Engine does not determine the conditions that run a Workflow against an RITM, what does?

  9. Close the Workflow Properties form using the X in the upper right-hand corner.

  10. Double-click on the Get Manager Approval Activity.


  11. Click the Users Lock icon.


  12. Click the Select users (Tree icon) to the right of the entry field. Dot walk to follow this path: Opened by > Department > Department Head.



    The ${ } notation will interpret the values inside as a dot walk of the current record. In this case, the Current record is an sc_req_item Glide Record that has a reference field opened_by, which is a sys_user reference. The sys_user table has a manager field. The tree is a code assist tool for dot walking to assignment fields within the current record.

  13. Click Update on the Approval Form.

  14. In the Activities Tree, open the Approvals Category folder and select Approval Action.


  15. Drag an Approval Action onto the transition between Approval – User and Log Approved Log Message.
    The Approval Action is used to set the Approval state of the RITM record based on the outcome of the Approval.

  16. Fill out the fields as follows:
    • Name: Manager Approved
    • Action: Mark task approved
  17. Click Submit.


  18. Right-click on the white portion of the Manager Approved Activity.


  19. Select Copy Activity.

  20. Drag an Approval Action onto the transition between Approval – User and Log Rejected Log Message. Your screen should look like this:


  21. Double-click on the duplicated Manager Approved.
  22. Fill the form out as follows:
    • Name: Manager Rejected
    • Action: Mark task rejected
  23. Click Update.


  24. Move the transition endpoint of the Rejected condition to the Approval Action Manager Rejected.

  25. Create a transition from Manager Rejected to Log Rejected. Your screen should look like this:


  26. In the Activity Tree, expand the Tasks Category folder.
    QUESTION: There is a new Task in the Tasks folder that was not there earlier for Change Request. What can we assume about the Catalog Task Activity Definition?

  27. Drag a Catalog Task onto the transition between Log Approved and End Log Message. Your screen should look like this:


    Notice the variables in the Slush Bucket. These are the variables that are declared in the Variables Related List of the Catalog Item we looked at earlier. These variables can be moved to the Selected field and provided to the User who will be assigned the task.

  28. Select the 3 variables from the Available list and move them to the Selected list.

  29. Fill out the rest of the form as follows:
    • Name: Fulfill Subscription Task
    • Assigned to: K14Task – TwoUser
    • Short description: Magazine Subscription Order Fulfillment
    • Instructions: Please order this magazine
  30. Click Submit.
    Your workflow should look like this:


  31. Return to the main ServiceNow tab.

Add Service Catalog K14 Category

  1. Navigate to Service Catalog > Catalog

  2. Add the Knowledge14 – WF 201 Lab category:
    • Click +.
    • Select Knowledge14 – WF 201 Lab
    • Place in the top dropzone



  3. Select the Knowledge 14  - WF 201 Lab category.


  4. Select the K14 WF 201 Example – Request Subscription.

  5. Accept the default values and select Order Now.


  6. Select the link to the RITM.

  7. Switch to the Catalog View.

  8. Scroll to the Approvers Related List

    QUESTION: Looking at the screen capture above and remembering your dot walk assignment in the Approval User Activity, what can we assume about the K14 Manager? Think of your dot walk.

  9. Right Click > Approve the K14 Manager approval. Notice that a Catalog Task record has been added and the Stage has updated. The workflow has updated the Stage field.



    QUESTION: Look at the Stage field. How did the value change from Requested to request_approved?

  10. In the Catalog Tasks Related List, open the Task record.


    QUESTION: How did the variables for the RITM get onto the Catalog Task form?

  11. Click Close Task.

  12. In the Request Item form, select the Show Workflow link in the Related Links list. Your workflow context should look like this:

Summary

The Service Catalog and Workflow Engine work together to fulfill Service Catalog Requests. Because of this the Workflow Engine does not evaluate the conditions of a Workflow that is written against the Requested Item [sc_req_item] table.

Workflows are assigned to Catalog Items in the Maintain Items module of the Service Catalog Application. When a Catalog Item, that has a workflow assigned to it, is ordered from the Service Catalog, the workflow will not start immediately. The progress of the Request Item (RITM) is waiting behind a Gateway Approval. Once the Gateway Approval has been approved, the Workflow of the RITM is started from within the Run Workflow Business Rule on the sc_req_item. This Business Rule is triggered by an update to the RITM record from a Business Rule on the parent sc_request.

So the Workflow Engine knows not to start a workflow that is associated with an RITM from within the Glide event (insert, update, delete or cancel). Instead, the RITM workflows are started by Business Rules pending the Gateway approval of the Service Catalog Request.

The Workflow Editor offers Activities that provide a designer a way to access the variable values of the RITM and to read and write values of the current record.