Order Guide Scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2015 09:55 AM
Hi All,
We have a requirement for order guide regarding New Employee hire.
We have two items in the order guide.(Desktop,Mobile).
We need a third item(Email Account) which is not included in the order guide to be attached in the cart automatically when checked out.
Using the below script for this :
var realCart = getCart();
var cartID = realCart.sys_id;
addToCart(cartID, "6d762a9620444640217b7fa6429f7b6a",1); //sys id of the cat item
doOrder();
function addToCart(cartid, cat_item, quantity) {
var gr = new GlideRecord('sc_cart_item');
gr.initialize();
gr.cart = cartid;
gr.cat_item = cat_item;
gr.quantity = quantity;
gr.insert();
}
function getCart() {
var cart = new GlideRecord('sc_cart');
var userid = gs.getUserID();
cart.addQuery('user', userid);
cart.query();
if (cart.next()) {
}
else {
cart.initialize();
cart.user = userid;
cart.insert();
}
return cart;
}
function doOrder() {
var req = new GlideappRequestNew();
req.copyCart();
}
So we tried running this script in Background script. its working fine.
Now the question is How to call the script..
Script include - Client script - Business rule.
Please suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2016 07:47 AM
We are attempting to add an item using a script as well. Actually, we're attempting to dynamically add the items based on selections in a list collector which points to catalog items. We're running into issues with the crumb fields on the cart. On submit, we can add the items to the cart and successfully update the crumb fields, but once the other rules on the order guide run, they are overwriting what we've put in the crumb fields, thus the items are not displaying on the choose options page. Does anyone have a idea of how to resolve this conflict?