ServiceNow Service Request - Cart API / generate request programmatically (sn_sc.CartJS() ) - RITM
https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server/sn_sc-namespace/c_CartJSScoped
var cart = new sn_sc.CartJS();
var item = { 'sysparm_id': '0d08837237153000158bbfc8bcbe5d02', 'sysparm_quantity': '1', 'variables':{ 'carrier': 'at_and_t_mobility', 'data_plan': '500MB', 'duration': 'eighteen_months', 'color': 'slate', 'storage': 'sixtyfour' }}; //var cartDetails = cart.addToCart(item);
var cartDetails = cart.orderNow(item);
gs.info(JSON.stringify(cartDetails));
//-- in case of errors, this will throw the error:
gs.print(JSON.stringify(cartDetails));
try also the submitOrder() and orderNow() functions
or this format:
gs.include('Cart');
var cart = new Cart();
var item = cart.addItem('d95447ce1b973010987d1fc3b24bcba0');
cart.setVariable(item, 'short_description', 'test');
cart.setVariable(item,'description','test test');
var rc = cart.placeOrder();
gs.print(rc.number);
(ServiceNow )
(ServiceNow )
Comments
Post a Comment