- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 10:25 PM
hi Team,
i have a order guide in mobile view. when ever I request a new thing in order guide will it insert a record in sc_cart every time?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 11:03 PM
sc_cart will be only a single entry and it just stores the owner name of the cart ie the requester. Every time you add an item to cart, a new entry is added in the sc_cart_item. Once you order or submit the cart, the entry added in the cart is removed from the sc_cart_item table and is converted to a request and sc_req_item entries. So sc_cart always remains the same but requests get added or removed from the sc_cart_item table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 11:03 PM
sc_cart will be only a single entry and it just stores the owner name of the cart ie the requester. Every time you add an item to cart, a new entry is added in the sc_cart_item. Once you order or submit the cart, the entry added in the cart is removed from the sc_cart_item table and is converted to a request and sc_req_item entries. So sc_cart always remains the same but requests get added or removed from the sc_cart_item table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 11:14 PM
So if that is the case. i am writting a bR to populate order guide name on request table.
But the filed is not updating. I am getting result in back ground script but in BR its not getting updated.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sc_cart");
gr.addQuery("user", gs.getUserID());
gr.query();
while(gr.next()){
gs.log("@@@$$$"+gr.name);
if(gr.name == "DEFAULT"){
var grcart = new GlideRecord("sc_cart_item");
grcart.addQuery('cart',gr.sys_id);
grcart.query();
while(grcart.next()){
if(grcart.order_guide != ""){
current.u_order_guide = grcart.order_guide.getDisplayValue();
gs.log("@@@$$$"+grcart.order_guide);
}
}
}
}})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 11:17 PM
Is this a before business rule? What is the field type of u_order_guide?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 11:19 PM
it is reference field to order guide table.. (i can make it string also its not a problem).
this br is on request table before insert/update.
i am doing in my demo dev only can u see there once dev68174
admin
Admin@123
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2018 11:21 PM
Sure checking