Multiple RITM creation for a Catalog Item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 03:57 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 02:33 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 03:01 AM
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