Created
November 24, 2021 14:07
-
-
Save ChecksumFailed/403e2cfbba4cdeaac312f57c0adfda25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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