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

Thanks for sharing the code it has given us some direction with our requirements however we have a slightly more specific requirement if you have any suggestions that will be really helpful. We are creating a catalog item that allows users to type in details in three different sections on the catalog item form and the requirement is to create individual Request Itesm for each value entered by users as we need item level approval for each of the values entered.


Yes you can do this. Using the same code in the workflow level.Create a workflow which would be used as a subworkflow. get the values of the three sections and pass it to the subworkflow using workflow.scratchpad.data1,workflow.scratchpad.data2,workflow.scratchpad.data3- Then in the subworkflow check the scratchpad items and create approvals by using approval activity.


tdivis
Kilo Contributor

Harshvardhan -



Did you find a solution to this request?   I am wanting to do something similar.   If the user selects 3 then it will clone it 3 times.



Thanks


Troy Divis


Rajshekhar Pau1
Kilo Guru

Hi Harshvardhan,



Please find the below helpful wiki article:



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



You need to enable bulk order request for catalog items. Kindly visit this Wiki page to follow the steps.



Please hit like or mark helpful based on impact.



Thanks,


Rajshekhar Paul


sergiodecristo1
Mega Expert

Hi Harshvardhan ,



i tried to solve your same requirement, but the solution is a bit complex.



I used a "run script" in the workflow of maintaint Item that you would split.



And i started   a business rules to fire the same Workflow on all the single cloned single Request item.



In the Run Script i used that to split and create a ritm(used already in a post of Chuck Tomasi) :



var listStr = current.variables.name_listcollector.toString(); //Variabile List Collector da Splittare


var list = listStr.split(',');


var IDritm;


for (var i = 0; i < list.length; i++) {


      var ritm = new GlideRecord('sc_req_item');


ritm.newRecord();


ritm.request = current.request;


ritm.u_multiritm=true;


//ritm.allthefielduneed;


ritm.insert()


      }


Then if u see there is a field that if true it start a workflow on the single Ritm, i hope u know how start a workflow on the single request.



I hope to be Helpful,



Sergio