Execute Catalog Item from Scheduled Job

Dudesdog
Tera Contributor

Hello Community,


I am attempting to have scheduled job run a catalog item every 6 months. I see where you can schedule this, however a script is not working. It does not seem to do anything when I execute however running the catalog manually seems to work.

 

Can someone give guidance? Thanks!

--------

 

var gr = new GlideRecord('sc_cat_item');
gr.get('removed_sysid_for_community_post');
var cart = new Cart();
var item = cart.addItem(gr.getUniqueValue());

var cartItem = new GlideRecord('sc_cart_item');
cartItem.addQuery('cart', cart.cartID);
cartItem.query();
while (cartItem.next()) {
cartItem.setValue('quantity', 1); // Adjust the quantity as needed
cartItem.update();
}

var rc = new SCReqItem(); // This class creates a new Requested Item (REQ)
rc.addItems(cart); // This adds all items from the cart to the REQ
rc.order();
1 REPLY 1

Dudesdog
Tera Contributor

To add on here, I am attempting to automate some workflows and this seems like the best way to do this. Some need to be done every week, some every 6 months, some once a year. Please let me know if there is a better way to go about this!