Not able to populate MRVS in the Native View

Akshay Palekar
Kilo Guru

I am trying to auto-populate the MRVS using an OnSubmit client script. The client script does a bunch of calculations and then populates the MRVS. So when I submit the catalog item through the service portal, it works as intended and I can see the values being populated in MRVS in the RITM. But, when I submit the same catalog item from the native view, the mrvs doesn't seem to get populated.

 

My OnSubmit client script is set to work in "All" UI Types. I also validated if the client script is running, and it is running properly and generating the JSON object needed to populate the MRVS. This is how I am populating the MRVS.

 

g_form.setValue('mrvs_internal_name', JSON.stringify(result));

 

Version: Vancouver

 

Again, this works perfectly in service portal, so the client script code is correct.

1 ACCEPTED SOLUTION

Akshay Palekar
Kilo Guru

A colleague help figure this one out, apparently onSubmit client script don't work on MRVS. In this case it seems it semi-works as I am able to use the onSubmit client script when submitting the request via Service Portal. 

 

https://docs.servicenow.com/bundle/washingtondc-servicenow-platform/page/product/service-catalog-man...

View solution in original post

4 REPLIES 4

AshishKM
Kilo Patron
Kilo Patron

Hi @Akshay Palekar ,

Are you setting whole MRVS in one variable. Can you share the complete code.

 

-Thanks,

AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi @AshishKM,

 

Thanks for your response. I did mention in my question itself that the OnSubmit script is set to "All" and is triggering correctly when I am trying to run it in the native view. But even with the client script running, the MRVS is not getting populated. 

I am building an object array, similar to this:

 

 

 

result = [{"var_1":"ABCSD","var_2":"20","var_3":"Critical"},{"var_1":"XYZ","var_2":"40","var_3":"High"},{"var_1":"PQRS","var_2":"5","var_3":"Low"},{"var_1":"YTRS","var_2":"40","var_3":"Critical"},{"var_1":"KJLM","var_2":"105","var_3":"Low"}]

 

 

 

Then just doing this:

 

 

 

g_form.setValue('mrvs_internal_name', JSON.stringify(result));

 

 

Akshay Palekar
Kilo Guru

A colleague help figure this one out, apparently onSubmit client script don't work on MRVS. In this case it seems it semi-works as I am able to use the onSubmit client script when submitting the request via Service Portal. 

 

https://docs.servicenow.com/bundle/washingtondc-servicenow-platform/page/product/service-catalog-man...