Skip to content
Tutorials Center
My learning

Topics

Lesson 38 of 39 ยท Projects and Practice

Project: A Catalog Item with Approval and Fulfillment

Build a Software Access Request catalog item: variables, UI policies, manager approval flow, catalog tasks, SLA and testing, with a JavaScript simulator of the whole flow.

This project builds one of the most common real-world solutions: a Software Access Request. An employee asks for access to an application, the manager approves, an administrator grants access, and the requester is told. It combines the catalog, variables, Flow Designer, approvals, tasks, notifications and security.

You build the real thing in your developer instance. The simulator below is JavaScript written for this lesson so that you can check the rules and the flow logic before you click through the menus. It is not ServiceNow code.

Requirements

  1. The employee picks an application (a choice list), an access level (read, standard, admin), and enters a business reason.
  2. If the access level is admin, a justification of at least 30 characters is mandatory and the application owner must also approve.
  3. The requester's manager always approves first.
  4. After approval, a catalog task goes to the IT Access group, with the requester, application and level.
  5. When the task closes, the requested item closes and the requester gets an email.
  6. If anyone rejects, the request closes as incomplete and the requester is told why.
  7. Target: fulfillment within 2 business days.

Step 1: the catalog item

Create the item in Service Catalog > Catalog Definitions > Maintain Items:

  • Name Software Access Request, category Software, short description Ask for access to a business application.
  • Variables: application (Select Box, mandatory), access_level (Select Box: Read, Standard, Admin; default Read), business_reason (Multi Line Text, mandatory), and admin_justification (Multi Line Text).
  • Catalog UI Policy: when access_level is Admin, make admin_justification visible and mandatory; otherwise hide it.
  • Catalog Client Script (onSubmit): if the access level is Admin and the justification is shorter than 30 characters, show an error and return false.
  • Availability: user criteria so that only employees see it.

Mirror the client check with a server check. A client script alone is not security: a business rule on sc_req_item or a flow condition should stop short justifications too.

Step 2: the flow

Create a flow with the Service Catalog trigger for this item:

  1. Get Catalog Variables action to expose the answers as pills.
  2. Ask For Approval: record is the RITM, approver is Requested for > Manager, rule "Approve when anyone approves; Reject when anyone rejects".
  3. If the approval is Approved:
    1. If access level is Admin: Look Up Record on the application table for the owner; Ask For Approval from the owner.
    2. Create Catalog Task: assignment group IT Access, short description Grant {level} access to {application} for {requester}.
    3. Wait For Condition: task State is Closed Complete.
    4. Update Record: RITM state Closed Complete.
    5. Send Email: "Your access has been granted."
  4. Else (rejected): Update Record RITM state Closed Incomplete, with a comment of the approver's reason, and Send Email to the requester.
  5. Add an error handler that opens a task for the catalog administrator if any step fails.
flowchart TD
    A["Request submitted"] --> M["Manager approval"]
    M -->|Rejected| X["Close incomplete, email requester"]
    M -->|Approved| L{"Access level is Admin?"}
    L -->|yes| O["Application owner approval"]
    L -->|no| T["Catalog task for IT Access"]
    O -->|Rejected| X
    O -->|Approved| T
    T --> C["Task closed: close RITM, email requester"]

Admin access needs a second approval; everything else goes straight to fulfillment after the manager.

Step 3: SLA and reporting

Add an SLA definition on sc_req_item for this item: 2 days on the 8-5 weekday schedule, start when Item is Software Access Request, pause when the item is waiting for approval if your policy says approval time should not count, stop on Closed Complete. Build a report: requests by application and average fulfillment time.

Step 4: tests

Case Input Expected
1 Read access, manager approves One task, closes, requester emailed
2 Admin, justification of 10 characters Blocked with an error message
3 Admin, owner rejects Closed Incomplete, no task
4 Manager rejects Closed Incomplete, owner never asked
5 Requester with no manager Error handler task, flow does not hang

Test with the Test button in Flow Designer, and then order the item as a normal user (use impersonation) to see the portal behavior.

Simulate the flow

The simulator takes a request and a list of approver decisions, and shows which tasks and emails the flow would produce, including the edge cases.

JS Simulator: approval flow for the access request

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Compare the output with your test table, and add cases of your own, such as an access level that is not in the list, or an approver who never answers. What should happen after three days of silence?

JS Simulator: business-day deadline for the SLA

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stretch goals

  • Add a cost and a quantity and approve by cost tier (a second approver above a threshold).
  • Turn the item into an order guide with a new hire bundle.
  • Show the item in Employee Center with a good short description and picture.
  • Add a recertification flow that asks owners yearly if admin access is still needed.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why repeat the justification length check on the server?

    Browser-side checks improve usability but are not enforcement.
  2. 2. How is the manager found for the approval?

    A pill like Requested for > Manager finds the approver dynamically.
  3. 3. What should the flow do if the requester has no manager?

    Always plan an explicit path for missing data.
  4. 4. Which catalog feature makes the justification field appear only for admin access?

    Catalog UI policies show, hide or require variables depending on conditions.

Summary

  • The project joins a catalog item, variables, UI policy, client and server validation, an approval flow, catalog tasks, an SLA and a report.
  • Admin access adds a second approval; rejections close the request as incomplete with a message.
  • Every failure path has a defined outcome; tests cover the edge cases.
  • The simulator lets you verify logic before building it on an instance.

Next: Practice Questions and Certification Preparation