How to validate MRVS values in RITM view?

Chintha Murali
Kilo Expert

I have a requirement in which a field in MRVS should only be visible in RITM and not in Service catalog view. I have to stop the submission of the RITM form if the field is empty. I have tried making the field mandatory in RITM view but it does not work(the RITM gets submitted anyway). Is there any way to access the values of MRVS using a client script or business rule on RITM?

1 ACCEPTED SOLUTION

Mohit Kaushik
Mega Sage
Mega Sage

Hi Chintha,

You can use the below code in your Business Rule to validate the values or MRVS

var mrvs = current.variables.test_var; // here test_var is the name of my MRVS.

// to access the variables inside your MRVS below code can help. For example you have a variable called Name in your MRVS then you can access it like this:
var total = mrvs.getRowCount(); // get the row count of mrvs
for(var i =0;i<total;i++)
{
  current.short_description = mrvs[i].name; //set the short description of RITM with mrvs data. Here 'name' is a variable on my mrvs.
}

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

View solution in original post

1 REPLY 1

Mohit Kaushik
Mega Sage
Mega Sage

Hi Chintha,

You can use the below code in your Business Rule to validate the values or MRVS

var mrvs = current.variables.test_var; // here test_var is the name of my MRVS.

// to access the variables inside your MRVS below code can help. For example you have a variable called Name in your MRVS then you can access it like this:
var total = mrvs.getRowCount(); // get the row count of mrvs
for(var i =0;i<total;i++)
{
  current.short_description = mrvs[i].name; //set the short description of RITM with mrvs data. Here 'name' is a variable on my mrvs.
}

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)