The CreatorCon Call for Content is officially open! Get started here.

Creating multiple request item from one catalog

harshvardhan_11
Giga Expert

Hi,

I have a requirement, where I have to create multiple requests or multiple request items under a single request using one catalog form having list collector variable.

If list collector have 3 values selected than 3 records to be created with other variables cloned to all the records. List collector is not referencing to user table so couldn't use functionality of bulk request.

I have seen some posts related to same topic, but couldn't get any answers from them.

Thanks in Advance.

12 REPLIES 12

amlanpal
Kilo Sage

Hi Harshvardhan,



I believe you want to order several items under one request. If this is the case you can try using Order Guides, Please see the link:


http://wiki.servicenow.com/index.php?title=Service_Catalog_Order_Guides#gsc.tab=0



I hope this helps.Please mark correct/helpful based on impact






Order guides are mostly used to order more than 1 catalog items at same time.



My requirement is something different. I want to create multiple request from 1 catalog item.



It should be all cloned to each other except for list editor variable which should be different in each request.


Community Alums
Not applicable

You'd probably want to use catalog tasks rather than individual requests for these items. That you way you can script the logic to create the tasks in your workflow, and you can customize which variables appear on which tasks using UI policies and/or the bucket list on each task definition in the workflow.



To me, this would be the simplest way to get what you want whilst using something that is fairly light on complex coding.


Manoj Kumar16
Giga Guru

Hi Harshvardhan,



You can use the API- GlideappCalculationHelper()




var reqHelper = new GlideappCalculationHelper();  


reqHelper.addItemToExistingRequest(current.request, 'bd6fa75a4f334200086eeed18110c79e',1); // 1 is the qty  


reqHelper.rebalanceRequest(current.request);



//update/add values to variables on item  


  var grReqItem = new GlideRecord('sc_req_item');  


  grReqItem.addQuery('request', current.request);  


  grReqItem.addQuery('cat_item','bd6fa75a4f334200086eeed18110c79e');  


  grReqItem.query();


  if(grReqItem.next()) {  


  grReqItem.variables.u_test = 'true';  


  grReqItem.parent = current.sys_id;  


  grReqItem.update();


  }  




You can use this in your workflow and generate as many request items form your catalog item, current.request is the request sys_id and the sys_id I have used here is the sys_id of the catalog item whose workflow I want to run on the Request item level.