Can a REQ/RITM/SCTASK be automatically scheduled?

jmeza
Tera Contributor

There's a monthly task that we'd like to associate with a REQ/RITM/SCTASK and have it be automatically created/assigned. Is that possible?

6 REPLIES 6

shantanu_patel8
Mega Guru

Hi @jmeza 

 

The functionality you are looking for is definitely achievable. Given that the catalog item is already existing in the system and you are looking for a way to create a request for this catalog item every month automatically. The easiest way to do it would be:

 

1. Create a event "order_catalog_item".

2. Create a script action for the event "order_catalog_item".

3. In the script action script, you can use the script from "CartJS" API to create the service request from the script. Refer to : https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc... to understand how you can order from the script.

4. Create a scheduled job which will run monthly. In the scheduled job you can trigger the event "order_catalog_item".

 

Please mark the answer helpful and correct if it resolves the issue. Happy scripting 

shantanu_patel8_0-1747288314553.png

 

 

-Shantanu

Hi @jmeza ,

 

I hope the issue is resolved or are you stuck somewhere with respect to the issue?

 

-Shantanu

Hi shananu, 

i haven't tried the solution yet but i will this week. thank you for your help!

Ankur Bawiskar
Tera Patron
Tera Patron

@jmeza 

yes this is possible

2 ways

1) Create a scheduled monthly flow and then use "Submit Catalog Item Request" flow action to submit the catalog item with your variables

check this link

Submit Catalog Item Request action 

OR

2) You can also use monthly scheduled job and script like this and use Cart API

try{

	var cartId = GlideGuid.generate(null);
	var cart = new Cart(cartId);
	//add your requested item to the cart by sys_id of the catalog item
	var item = cart.addItem('0336c34407d0d010540bf2508c1ed096', 1);

	//fill in the variables on the request item form
	cart.setVariable(item, "asset", "00a96c0d3790200044e0bfc8bcbe5dc3");
	cart.setVariable(item, "multiple_choice", "Phoenix");
	var rc = cart.placeOrder();
	gs.info(rc.number);

}
catch(ex){
	gs.info(ex);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader