Scheduled Job to create RITM and start workflow

booher04
Tera Guru

Hello All - I have a need to automatically submit a catalog item(to create RITM/SCTASKs) weekly.  I have the catalog item created, workflow created, but I was wondering if anyone has done this and what the best solution for this would be.  I created a scheduled workflow originally, however that doesn't quite work correctly.  It doesn't create the RITM that the user would like for reporting/tracking purposes.  It creates my catalog tasks, so that led me to possibly a scheduled job that runs every Monday at 7:30am, but not quite sure how that script would be setup.  Any ideas?  

1 ACCEPTED SOLUTION

dvp
Mega Sage
Mega Sage

 

Here is the script that can submit the catalog item

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('4054428fdb151f0097679ec6db9619c0', 1);

//fill in the variables on the request item form
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", email.subject);
cart.setVariable(item,"description", email.body_text);
var rc = cart.placeOrder();

 

https://community.servicenow.com/community?id=community_question&sys_id=928a9f4ddb73ab805ed4a851ca961926

 

View solution in original post

1 REPLY 1

dvp
Mega Sage
Mega Sage

 

Here is the script that can submit the catalog item

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('4054428fdb151f0097679ec6db9619c0', 1);

//fill in the variables on the request item form
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", email.subject);
cart.setVariable(item,"description", email.body_text);
var rc = cart.placeOrder();

 

https://community.servicenow.com/community?id=community_question&sys_id=928a9f4ddb73ab805ed4a851ca961926