- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 09:26 AM
Dear Community,
I am trying to create shopping cart items within a script with sn_sc.CartJS() on my Tokyo PDI.
I tried this in the script editor (Background scripts) - see code below.
I always receive the error message: "
com.glide.script.RhinoEcmaError: Cannot find default value for object
and it points to the line:
cart.addToCart(request);
Here my small code:
var quantity = 1;
var myID = '6816f79cc0a8016401c5a33be04be441'; //sysid of user admin
var cat_item = ('21874084472311104306bce5536d43a6');//sysid of catalog item
var cart = sn_sc.CartJS();
var variables = {};
var request = {
'sysparm_id': cat_item,
'sysparm_quantity': quantity,
'sysparm_requested_for': myID,
'variables': variables
};
cart.addToCart(request);
I also tried to handover a string to the CartJS-function but I always get the same error.
Many thanks for your ideas.
Best regards
Eckhard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 09:39 AM - edited 11-28-2022 09:39 AM
Hello,
Please use the below line:-
var cart = new sn_sc.CartJS();
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 09:39 AM - edited 11-28-2022 09:39 AM
Hello,
Please use the below line:-
var cart = new sn_sc.CartJS();
Please mark my answer as correct based on Impact.