Hi Prudhvi,
In case you've described above you need:
1 Add to your project "update items" service.
2 on "success" event of service which is "place the order" you need to run following code:
pre
//Note you should replace "shoppingItemsTable" with your shopping item table name.
var shoppingItems = Apperyio("shoppingItemsTable");
for(var i = 0; i < shoppingItems.length; i++){
Code: Select all
var currentItem = jQuery(shoppingItems[i]);
//Note: you should replace "itemIdLabelName" with label name which is inside item and contain item id.
var currentItemId = currentItem.find("itemIdLabelName").text();
console.log("currentItemId = " + currentItemId);
//Note: you should replace "itemRemaningLabelName" with your label name which is inside item and contain item Remaning Units.
var currentItemAvaliableItems = currentItem.find("itemRemaningLabelName").text();
console.log("currentItemAvaliableItems = " + currentItemAvaliableItems);
//Note you should replace "yourUpdateService" with your update service datasource name.
yourUpdateService.execute({ data: {"_id": currentItemId, "avl": currentItemAvaliableItems} });
};
/pre
This code will iterate through your all items sends update request for each item.
Also this code has some "console.log" debug information. Please checkut your console if you will have some problems.
Regards.