- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2020 08:07 AM
I'm using the Cart API to create a cart and an item and subsequent request. This all gets created OK but when trying to set the special_instructions field on the request it does not get set.
Can anyone tell me what I am doing wrong?
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('b70cc309db2797804aba70600f961934');
var rc = cart.placeOrder(); // rc = request
gs.log("RGK - Created OK - number = " + rc.number);
gs.log("RGK - Created OK - requested_for = " + rc.requested_for);
//rc.special_instructions = current.description; // not getting set
rc.special_instructions = "12345"; // not setting
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 10:10 AM
Cart runs on request. Special instructions is on the request table. Your gliderecord is also on request. So instead of using gliderecord, change your script adding below between var item and var rc:
var cartGR = cart.getCart()
cartGR.special_instructions = current.description;
cartGR.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 10:14 AM
Using the script above such as
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('b70cc309db2797804aba70600f961934');
var rc = cart.placeOrder(); // rc = request
gs.log("RGK - Created OK - number = " + rc.number);
gs.log("RGK - Created OK - requested_for = " + rc.requested_for);
//rc.special_instructions = current.description; // not getting set
rc.special_instructions = "12345"; // not setting I found that delivery_address(add Notes/Comment) has value 'CA'. I am just wondering why it has default value 'CA' for delivery_address
