sn_sc.CartJS() doesn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 03:35 AM
Dear community,
I'm struggling with my recent problem in that I can't use CartJS() properly for some reasons.
I'm trying to log some requests in a GlideRecord loop by this script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 03:59 AM
Hello @Theodor ,
The orderNow() function returns an object that contains information about the order. Check if this object is being returned correctly and if it contains the information you need. You can log the entire object by using gs.info(JSON.stringify(cartDetails));.
Kindly mark correct and helpful if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 04:19 AM
Hi Chetan,
The result is the same undefined:
The problem is not only the details are displayed as "Undefined" but the requests are not raised at all !!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 04:23 AM
You can try Cart() instead sn_sc.CartJS(). give it try as below in your script
gs.include('Cart');
var cart = new Cart();
var req = cart.addItem('65e370ab0a0a3c8101d88e2b883c9efd'); //Cat Item sys_id
cart.setVariable(req , 'hr_end_employee_for_which_user',gr.getUniqueValue());
cart.setVariable(req , 'hr_end_employee_user_manager', gr.manager);
cart.setVariable(req , 'hr_end_employee_user_manager', gr.location);
cart.placeOrder();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 06:56 AM - edited 04-03-2023 09:41 AM
Hi Chetan,
Unfortunately that was my first option. It worked but Cart can place only one order and can not be used in a loop. It worked to raise only one request and then gets stuck.