Why RITM Variables are not Showing when Service Request Created in Virtual Agent using CartJS API

PareshW
Tera Contributor

While Creating the Service Request Using CartJS API unable to show the RITM Variables.Issue.PNG

1 ACCEPTED SOLUTION

@PareshW 

so the variable editor is showing but only few variables are visible?

Did you check in variable ownership table if other variables are having value or not?

Also any catalog client script etc which is hiding the other variables on RITM form which are having "Applies on Requested Items" checkbox as true?

sc_item_option_mtom table

AnkurBawiskar_0-1746778456330.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@PareshW 

it should show in variable editor.

It's not showing any variable in variable editor?

Share the script how you are setting the variables and where have you written that script?

how are you testing that?

It should be like this

try{
	var cart = new sn_sc.CartJS();
	var item =
		{
			'sysparm_id': '0336c34407d0d010540bf2508c1ed096',
			'sysparm_quantity': '1',
			'variables':{
				'user': '7282abf03710200044e0bfc8bcbe5d03',
				'asset': '00a96c0d3790200044e0bfc8bcbe5dc3',
				'multiple_choice': 'Phoenix',
			}};
	var cartDetails = cart.addToCart(item);
	var checkoutInfo = cart.checkoutCart();
	gs.info('Order details' + JSON.stringify(checkoutInfo));
}
catch(ex){
	gs.info('Exception'+ex);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

It is not showing in Variable Editor. 

 

Please find the below Script, In this only description, list_member_store1, platform2 and network_folder_options are showing and remaining is not.

 

Please let me know if any thing is found here.

(function execute() {
   var cart = new sn_sc.CartJS();
   
   var newItem = cart.addToCart({
	   "sysparm_id": vaVars.User_Groups_Catalog_Item_Sys_ID,
	   "sysparm_quantity": "1",
       "sysparm_requested_for": gs.getUserID(),
		   "variables":{
		   "platform2": "office",
           "network_folder_options": "create_group",
		   "group_name_new": vaInputs.group_to_create,
           "application_name": vaInputs.application_name,
           "appcat_code": vaInputs.appcat,
           "segregation_of_duties": vaInputs.segregation_of_duties,
           "is_this_ad_only": vaInputs.is_this_ad_only,
           "new_group_used_for": vaInputs.group_used_for,
           "will_this_group_for_oc_users_only": vaInputs.domain,
           "select_new_group_ou": vaInputs.organizational_unit,
           "list_member_store1": gs.getUserID(),
		   "description": "VA: Create new group -- " + vaInputs.group_to_create
	   }
   });
   
   var checkoutInfo = cart.checkoutCart();

   vaVars.Request_Number = checkoutInfo.request_number;
})()

 

@PareshW 

so the variable editor is showing but only few variables are visible?

Did you check in variable ownership table if other variables are having value or not?

Also any catalog client script etc which is hiding the other variables on RITM form which are having "Applies on Requested Items" checkbox as true?

sc_item_option_mtom table

AnkurBawiskar_0-1746778456330.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@PareshW 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader