Getting Error - MRVS Data fetch RITM to catalog item

Amit Naik1
Tera Contributor

 

I am trying to copy the MRVS data from an existing RITM and put it in a new catalog item by using GlideAjax, and when I am trying to put the request in the cart or submit, it gives me an error: "Something went wrong on your request; it could not be submitted. Please contact your system administration."

I used the following method, but it didn't work. Does anyone have a solution for this or have come across this issue before? 

Server side - 

getMRVS:function(){
	//var aa={};
	var gr=new GlideRecord('sc_req_item');
	gr.get('444db8712f96b01042162b5df699b654');
	var mrv=gr.variables.my_values.toString();
	return  JSON.stringify(mrv);
}

Client side -

var gr=new GlideAjax('AjaxUtil');
gr.addParam('sysparm_name','getMRVS');
gr.getXML(GetMRVS);
function GetMRVS(response){
	var answer = response.responseXML.documentElement.getAttribute("answer"); 
	var mrv=JSON.parse(answer);
	console.log(mrv);
	g_form.setValue('my_values',mrv);
}

 

AmitNaik1_0-1711465057127.png

 

 

7 REPLIES 7

Do you see the MRVS rows populated correctly before submitting?  Try logging the contents of what you are retrieving:

 

getMRVS: function() {
		var mrv = '';
        var gr = new GlideRecord('sc_req_item');
        if (gr.get('444db8712f96b01042162b5df699b654')) {
            mrv = gr.variables.my_values.toString();
		}
        gs.addInfoMessage(mrv);
		return mrv;
    },

 

Is it formatted like this?

BradBowman_0-1711653691384.png

Or are the [] missing, or are there extra " or other formatting characters,...?  Are you using the native UI, or Service Portal / ESC / ...?  If you look in the browser tools, do you see any errors in the console log?

 

@Brad Bowman  : Thanks for seeing the issue in dept. We are using ESC.
Following response I get 

 

AmitNaik1_0-1711691523264.png

 

AmitNaik1_1-1711691603594.pngAmitNaik1_2-1711691650132.png

 

AmitNaik1_3-1711691860678.png

 

It is really strange why I am getting this issue as I am following standard scripting.

I don't have ESC, but it should be similar to Service Portal.  Are you able to try the same there, and/or in the native UI.  I tried my example in Service Portal, got the same console errors/messages, but it worked.  Do you see anything in the system log when this attempt is made? If you edit and save each row, without necessarily changing anything does it work?  Another thing to try is a simple example - so on the RITM you are retrieving, populate one variable in one row to see if that works.  Are any of the MRVS variables mandatory?  I know I have encountered this problem before - not sure if it was when populating a MRVS, or something else, but I can't think right now what the resolution was, or if I found a workaround.  I'll keep thinking on that.