top of page

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,000

How to Submit a ServiceNow Catalog Item via Script

Updated: Mar 29


Creating automated requests in ServiceNow is a common requirement, especially for routine tasks that recur regularly. One efficient method is submitting a catalog item programmatically. This article explains how to automate the submission of catalog items using scripts, ensuring tasks follow predefined workflows.


Common Challenges When Submitting Catalog Items via Script

A common scenario involves creating an automatic Request Item (RITM) periodically, such as monthly. Often, administrators try scripting this process and encounter difficulties like incorrectly defining objects or misusing GlideRecord APIs, resulting in errors or uncreated records.

Typical mistakes include:

  • Instantiating cart APIs improperly.

  • Missing variable definitions.

  • Incorrect usage of the cart and request APIs.


Verified Solution: Automating Catalog Item Submission

The recommended and verified approach involves the ServiceNow Cart API, which correctly handles catalog item submissions through script execution.


Step-by-Step Guide:

Step 1: Set Up a Scheduled Job

First, create a scheduled job under System Definition > Scheduled Jobs, configuring it to run on your desired frequency (e.g., monthly).

Step 2: Implementing the Script

Use the following script template as a reference for automating catalog item submission:

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);

// Add the requested catalog item to the cart using its sys_id
var item = cart.addItem('4054428fdb151f0097679ec6db9619c0', 1);

// Set required catalog item variables
cart.setVariable(item, "u_requested_for", "e80edd6edbec6bc097275e25ca9619a4");
cart.setVariable(item, "contact_number", "0");
cart.setVariable(item, "assignment_group", "87ec1c342b2e71406c487fb5a8da1524");
cart.setVariable(item, "application_service", "cdedfbcedb0f9744c291c170ba9619a7");
cart.setVariable(item, "short_description", "Monthly Automated Request");
cart.setVariable(item, "description", "This request was automatically generated by the scheduled job.");

// Place the order and get the request object
var request = cart.placeOrder();

// Optionally, update the Request Item (RITM)
var ritmGr = new GlideRecord("sc_req_item");
ritmGr.addQuery("request", request.sys_id);
ritmGr.query();

if (ritmGr.next()){
    ritmGr.u_requested_by = "e80edd6edbec6bc097275e25ca9619a4";
    ritmGr.work_notes = "This RITM was automatically created.";
    ritmGr.update();
}

Alternative Approaches

  • Flow Designer: ServiceNow Flow Designer provides a no-code alternative for automating catalog item submissions and is ideal for organizations running versions Kingston and later.

  • CartJS API: Advanced users might prefer using the newer CartJS API for additional flexibility, such as directly setting the 'Requested For' field.


Conclusion

Automating catalog item submission through scripting significantly streamlines repetitive tasks and ensures consistency. By following the provided step-by-step instructions, administrators can reliably set up scheduled, automated Request Items (RITMs). Consider exploring the Flow Designer or CartJS APIs for more advanced automation requirements or newer ServiceNow versions. Always test scripts thoroughly in a non-production environment before deploying them to production.

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,000

CONTACT

New Zealand HQ

Integrated Knowledge Consulting Office

Level 3, 93 Grafton Road

Auckland

South Korea

Integrated Knowledge Consulting Office

BMY역삼타워 6층

서울특별시 강남구 역삼동 678-10번지

 

info@ikconsulting.com

Thanks for submitting!

  • LinkedIn Social Icon

© Copyright 2025 Integrated Knowledge Consulting. All rights reserved.

bottom of page