- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023 06:06 AM
HI community
Im trying to raise a RITM via a Scheduled job using the Cart API and not been succesful so far . Any thoughts here please.
We are on Tokyo version with 2 step checkout enabled and I am using the new CartJS API.
After formatting the item JSON tried using both cart.checkoutCart(item) as well as cart.orderNow() but both case REQ/RITM is not generated . I checked to see all mandatory variables are populated
var reqfor = usersysid.toString();
var cart = new sn_sc.CartJS();
cart.setRequestedFor(reqfor);
var item =
{
'sysparm_id': 'my catalog item sysid',
'sysparm_quantity': '1',
'variables':{
'var1': var1value,
'var2': var2value,
}};
//var cartVals = cart.addToCart(item);
//var checkoutVals = cart.checkoutCart();
var cartDetails = cart.orderNow(item);
gs.info('cartDetails '+JSON.stringify(cartDetails));
Result : New "DEFAULT" cart record is created and Requested For is blank . All variables came through properly in sc_cart_item . But No RITM generated likely because the user is blank in the Cart
in the script log -seeing all the vals right and returning the cart Id properly
Any advice on this please
Thanks
Lann
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 05:21 AM
Hi Tushar
Thanks for looking into this.
The Requested for is supposed to be set right as cart.setRequestedFor(reqfor) is there with right sysid of user. Actually it is the User field in the Cart that is blank
After multiple trials i find that addtocart and then check out cart doesnt work for us in a 2 step checkout setup.
var cartVals = cart.addToCart(item);
cart.setRequestedFor(reqfor);
var checkoutVals = cart.checkoutCart();
However when using addtocart and then using cart.submitOrder(item) it generates the RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023 08:27 AM
Hey Lann,
It seems that the issue might be related to the "Requested For" field not being set properly in the cart. When you create a cart using the CartJS API, you need to ensure that the "Requested For" field is set to the user for whom you want to raise the RITM.
Regards,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 05:21 AM
Hi Tushar
Thanks for looking into this.
The Requested for is supposed to be set right as cart.setRequestedFor(reqfor) is there with right sysid of user. Actually it is the User field in the Cart that is blank
After multiple trials i find that addtocart and then check out cart doesnt work for us in a 2 step checkout setup.
var cartVals = cart.addToCart(item);
cart.setRequestedFor(reqfor);
var checkoutVals = cart.checkoutCart();
However when using addtocart and then using cart.submitOrder(item) it generates the RITM