How to generate a RITM from a record producer

mdjoseph12
Giga Contributor

Knowing that ServiceNow advices using a catalog item as opposed to a record producer to generate a RITM, we have a requirement to have agents submit a RITM on behalf of a caller. To achieve this from the user interface, I wanted to generate a ritm from a record producer. Is this possible? If so, how could I trigger the workflow once the ritm is created? 

1 ACCEPTED SOLUTION

Dubz
Mega Sage

Why can't your users just request the catalog item through the service catalog as normal?

If you want to use a record producer i suppose you could use one to create a request record and then use some of the fields on the record producer to populate the request item variables. The script below can be used to create request items and relate them to a parent request.

var itemGr = new GlideRecord("sc_req_item");
itemGr.initialize();
itemGr.cat_item = 'sys_id of catalog item';
itemGr.request = 'sys_id of parent request';
itemGr.state = 1;
var reqItem = itemGr.insert();

var optionGr = new GlideRecord('sc_item_option');
optionGr.initialize();
optionGr.item_option_new = 'sys_id of catalog item variable';
optionGr.value = 'variable value';
var itemID = optionGr.insert();

var relGr = new GlideRecord('sc_item_option_mtom');
relGr.initialize();
relGr.request_item = reqItem;
relGr.sc_item_option = itemID;
relGr.insert();

var startWF = new GlideRecord('sc_req_item');
if(startWF.get(reqItem)){
	startWF.setForceUpdate(true);
	startWF.update();
}

View solution in original post

6 REPLIES 6

No, your record producer would create a request and then your after insert BR would create the request items and relate them to the parent request. 

You could add a field or some syntax in the description to delineate portal vs record producer requests but if you already have these items set up in the catalog why don't your users just add them via the catalog in the same way as your customer would?

Fred Jean
Tera Expert

Instead of using GlideRecords and create all individual record needed, you could also use the Cart API :

You could also use the Cart API for this  :

https://docs.servicenow.com/bundle/tokyo-application-development/page/app-store/dev_portal/API_reference/CartJSScoped/concept/c_CartJSScoped.html