Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Multiple RITM creation for a Catalog Item

Bhaskar24
Tera Expert

Hi Guys,

 

Could you please help me on the below:

I have a requirement to create multiple RITMs for a Catalog Item.

The Catalog Item contains Variable: Requested For with type: List Collector. If we choose 5 users in this variable 5 RITMs should be created for 5 users.

 

Thanks

6 REPLIES 6

Lisha1
Kilo Explorer

Hi ,

After submit the catalog item, run the business rule by using CartAPI

see the below code:

(function executeRule(current, previous /*null when async*/) {

// Add your code here
//var gr = new Cart();
var list = current.description.toString(); //variable containing users list
var list_split = list.split(',');
for(var counter = 0 ; counter< list_split.length; counter++){
gs.addErrorMessage("am in for");
var cart = new Cart();
var item =cart.addItem('71f645a70f33230071b806ace1050e9d');
cart.setVariable(item,"requested_for",list_split[0]);
//cart.setVariable(item,"category",'other');
cart.placeOrder();
}

})(current, previous);

Hi Lisha,

 

Thanks for your reply. May I know, on which table do I need to write the BR and what are the conditions: before insert / after insert?

 

Thanks