Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ChecksumFailed/403e2cfbba4cdeaac312f57c0adfda25 to your computer and use it in GitHub Desktop.
Save ChecksumFailed/403e2cfbba4cdeaac312f57c0adfda25 to your computer and use it in GitHub Desktop.
var getCartItem = function (sys_id) {
var gr = new GlideRecord("sc_cart_item");
gr.get(sys_id);
return gr;
};
var addAttToCartItems = function (items,cat_item) {
var attachment = new GlideSysAttachment();
//set up inputs
var fileName = 'atfTest.txt';
var contentType = 'text/csv';
var content = 'atfTest';
items.forEach(function(item) {
attachment.write(getCartItem(item.cart_item_id), fileName, contentType, content);
});
};
var cart = new sn_sc.CartJS();
var item = {
'sysparm_id': '3f1dd0320a0a0b99000a53f7604a2ef9',
'sysparm_quantity': '1',
'variables': {
'comments': 'testing att',
'urgency': 3
}
};
var cartDetails = cart.addToCart(item);
addAttToCartItems(cartDetails.items);
cart.checkoutCart()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment