Scripted Cart Order Issue with MRVS

Community Alums
Not applicable

I have a catalog item to order access which has a MRVS. In it's simplest form you only have to answer 3 questions to add a row. 

ChrisDoernbrac_1-1695857904228.png

 

 

There are other questions that can surface if for example you request elevated. I am trying to run a simple script within another catalog item to call this catalog item. It works but it fails to order. 

 

var cart = new sn_sc.CartJS();
var user = 'e5a976ee1b9dbd10176a98e02a4bcb88';
var manager = 'f9ac97bcdbe21d1848b7c4c2ba961900';
 
var item = {
'sysparm_id': '5910f0d5dbdc71106df6cf0913961987',
        'sysparm_quantity': '1',
        'variables': {
'within_the_last_14_days': 'No',
                'requested_for' : user,
                'requested_by' : manager,
                'access_selection': '[{"action":"Add","account_type":"normal","access_name":"d8c975591b8e7050f8fa43f8b04bcb3a"}]'
 
}
};
var cartDetails = cart.addToCart(item);
 
When I look at the resulting RITM I see that its adding null values for the questions I did not provide answers for. 
 
1.jpg

 


 


When I order this catalog directly and enter in the same 3 answers, the resulting RITM does not show null values in the MRVS.

 

2.jpg

 


Is there something I am doing incorrectly with the cart script? I assumed I didn't need to specify the variables I was not setting.

 

 

 
 
1 ACCEPTED SOLUTION

Community Alums
Not applicable

I found the issue. I need to specify empty values in the json. 

 

'access_selection': '[{"action":"Add","account_type":"normal","access_name":"d8c975591b8e7050f8fa43f8b04bcb3a","domain":"","business_justification":"", "in_active_directory":"","location":"","other_location":"", "user_id_for_elevated_account":"" }]'

View solution in original post

1 REPLY 1

Community Alums
Not applicable

I found the issue. I need to specify empty values in the json. 

 

'access_selection': '[{"action":"Add","account_type":"normal","access_name":"d8c975591b8e7050f8fa43f8b04bcb3a","domain":"","business_justification":"", "in_active_directory":"","location":"","other_location":"", "user_id_for_elevated_account":"" }]'