Skip to content

Commit 8575dc9

Browse files
authored
Create create_request_using_script.js
1 parent 69bdfc6 commit 8575dc9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
var cart = new sn_sc.CartJS();
3+
//define variables
4+
var itemDetails = {
5+
'sysparm_id': 'catalog_item_sys_id',
6+
'variables': {
7+
'requested_for': 'user_sys_id'
8+
/*
9+
.
10+
.
11+
remaining variables
12+
.
13+
.
14+
*/
15+
}
16+
};
17+
18+
// Add item to cart (returns item sys_id within the cart)
19+
var cartItem = cart.addToCart(itemDetails);
20+
gs.info('Added catalog item to cart: ' + cartItem);
21+
22+
// -- Place the order ---
23+
var order = cart.checkoutCart();
24+
gs.info('Order placed successfully. Request Sys ID: ' + order.request_id);

0 commit comments

Comments
 (0)