Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Service catalog - automated ticket customization

SaurabhMahe
Tera Contributor

Hi Team,

 

We have configured a laptop service catalog that includes fields for issuance type: Permanent and Temporary. If a user selects Temporary, an additional question for the End Date is displayed. We now have a requirement to automatically trigger a new ticket when the End Date is reached, to initiate the process of collecting the laptop from the user. This ticket should be created on behalf of the user, ensuring they receive a notification from the system to return the laptop. How can we achieve this requirement.

 

Same logic we want to implement for other catalogs which has end date. so we want to implement the solution at platform level based on catalog name configuration.

5 REPLIES 5

_ukasz Rybicki
Giga Guru

Summary

ServiceNow does not natively create return-tickets when a catalog item’s End Date arrives, so we can leverage either Flow Designer’s Scheduled Trigger or a Scheduled Script Execution to automate it. Flow Designer offers a No-Code approach using Date triggers and “Look Up Records”/“Create Record” actions, with a small configuration table for platform-level control (ServiceNow). Community examples show daily scheduled flows for catalog requests (ServiceNow) and even monthly incident creation with custom schedule logic (ServiceNow).


1. Problem Identification

  • Cause: ServiceNow doesn’t OOTB monitor a catalog item’s End Date to spin up a return ticket—this is expected behavior.

  • OOTB/No Code?: Yes—use Flow Designer’s Scheduled Trigger and actions, no scripting required.

  • Other Tools: You can also use Scheduled Script Executions, Business Rules + Flow API, Postman for one-off tests, or SN Utils for data checks.

  • Code Guidelines: If scripting, keep it in a Scheduled Job with simple if/else and inline comments; no new libraries or functions.

  • Alternatives: A Scheduled Script Execution with GlideRecord (see Solution 2).

  • Technical Tables:

    • Request Items: sc_req_item

    • Catalog Items: sc_cat_item

    • Tickets: incident

  • Manual Tasks: Activate Service Catalog Flow plugin, create config table, build and test flow/job, set up notifications.

  • Community Examples:

    • Scheduled flow for catalog item request: CathyD (Flow Designer) (ServiceNow)

    • Monthly scheduled incident: JSiva (Flow Designer) (ServiceNow)


2. Proposed Solutions

2.1 Flow Designer Solution

General Proposal (<100 words)

Use a Scheduled Date Trigger in Flow Designer to run daily, Look Up Records on sc_req_item for Temporary issuance items whose u_end_date ≤ Today, then Create Record on incident with caller_id = requested_for, and finally Update Record to flag processed. Manage which catalogs to process via a simple config table.

Detailed Steps (<250 words)

  1. Activate Plugin: Ensure Flow Designer support for Service Catalog (com.glideapp.servicecatalog.flow_designer) is active.

  2. Config Table: Create u_catalog_return_config referencing sc_cat_item; add each catalog sys_id.

  3. New Flow: In Flow Designer, create “Return Ticket Scheduler” in your scope.

  4. Trigger: Add a Scheduled trigger set to run daily at 02:00. (ServiceNow)

  5. Look Up Records:

    • Table: sc_req_item

    • Conditions:

      • u_issuance_type = Temporary

      • u_end_date ≤ today()

      • u_return_ticket_created != true

      • sc_cat_item IN config table

  6. For Each: Loop results.

  7. Create Record (Incident):

    • caller_id = Requested For

    • short_description = "Return due: " + number + " on " + u_end_date

  8. Update Record (sc_req_item): Set u_return_ticket_created = true.

  9. Activate & Test: Run on-demand; verify Incident creation and flag update.

Testing

  • Create a Temporary Laptop RITM with End Date = Today.

  • Run flow manually; confirm an Incident appears with correct caller, description, and RITM flagged.

Example (max 100 words)

For the Laptop Issuance catalog (sys_id abc123), the flow runs each morning, finds Temporary RITMs with today’s End Date, auto-creates an Incident assigned to IT Ops, and marks u_return_ticket_created to prevent duplicates. 📱💻👥


2.2 Scheduled Script Execution Solution

General Proposal (<100 words)

Create a Scheduled Script Execution that runs daily at 02:00, queries sc_req_item for Temporary items whose u_end_date is reached and not yet processed, loops through each record, creates an incident via GlideRecord, sets caller_id to requested_for, and updates the RITM flag.

Detailed Steps & Code

  1. Navigate: System Definition > Scheduled Jobs > New.

  2. Name: “Return Ticket Scheduler”.

  3. Schedule: Daily at 02:00.

  4. Script:

    // Return Ticket Scheduler
    var gr = new GlideRecord('sc_req_item');
    gr.addQuery('u_issuance_type','Temporary');
    gr.addQuery('u_end_date','<=',gs.todayDateTime());
    gr.addQuery('u_return_ticket_created','!=',true);
    gr.query();
    while (gr.next()) {
      var inc = new GlideRecord('incident');
      inc.initialize();
      inc.caller_id = gr.requested_for;
      inc.short_description = 'Return due: ' + gr.number + ' on ' + gr.u_end_date;
      inc.insert();
      gr.u_return_ticket_created = true;
      gr.update();
    }
  5. Save and Test: Run manually; verify incidents and flags.

Testing

  • Execute the job on-demand; ensure incidents are created for suitable RITMs and their u_return_ticket_created is set.


Sources

  1. Flow triggers types: ServiceNow Docs on Flow Designer triggers (ServiceNow)

  2. Scheduled flow example: CathyD – Flow in Flow Designer using a Scheduled Trigger (ServiceNow)

  3. Monthly scheduled incident: J Siva – Create an incident on first working day of the month using flow (ServiceNow)


Please mark as correct if this solves your requirement!