Parent mrvs variable passing the value to child variable through script include, its not updating

servicenow pla1
Tera Expert

HI Community,

Need yours assistance please on below issue 

Parent RITM mrvs variable passing the value to child RITM variable through script include, its not updating actual value. Its updating "com.glide.catalog.scripting.rhino.impl.GlideElementScriptingModel$2@5533d9de" how to fix this.

 

parent MRVS variable type is selectbox and child variable type selectbox and using below script

ritm.variables.business_name = current.variables.MRVS.business_name;

Please find below screen shot and help

servicenowpla1_0-1728989932124.png

 

Advance Thanks yours response



1 ACCEPTED SOLUTION

Hi @Brad Bowman  @Omkar Mone @sadif_raja 

 

Thanks you all for your time and your suggestions, I have learned something new from your responses.

 

Finally I have done deep analysis on my code and find the issue and fixed.

 

Actually My requirement is

Parent RITM -> Child RITM->ChildRITM

 

1. Parent RITM variableset variable type is select box and child variable type is select box

2.Parent RITM variable have choice values

  1.business_service

  2.technical_service

3.child variable choice values different 

  1.business_app

   2.technical_services

 

Both variables choice values is different so I mapped used below script 

 

Var abName = current.variables.mrvs.variablename;

var is_business_app = ' ';

 

If(abName == 'parent choice value i.e business_service'){

is_business_app = 'child choice value i.e business_app';

}else if(abName == 'parent choice value i.e technical_service'){

is_business_app = 'child choice value i.e technical_services';

}

 

ChildRITM.variables.childvariableName = is_business_app;

 

Finally this code fixed the Issue, I hope this will helpfull others also.

 

Thanks to ServiceNow Community.

 

View solution in original post

21 REPLIES 21

Omkar Mone
Mega Sage

Hello,

 

Can you try ritm.variables.business_name = current.variables.MRVS.business_name.getDisplayValue();

HI  I tried getValue() and getDisplayValue() both functions not worked

Brad Bowman
Kilo Patron
Kilo Patron

You can get the parent RITM MRVS in its entirety using the mrvs_internal_name instead of the business_name (which is the name of a variable in the MRVS?).  Once you have this value you can loop through (each row) to retrieve the value of a variable.  In your scenario, to get the value of a variable named business_name in the MRVS that has the internal name of my_mrvs in the first row where it is populated - since there could be many rows/values for this variable and you are putting it into a single selection variable, this part of the script would look like this, if I'm following your example correctly:

var mrvs = current.variables.my_mrvs;
var rowCount = mrvs.getRowCount();
for (var i = 0; i < rowCount; i++) {
	var row = mrvs.getRow(i);
	if (row.business_name) {
		ritm.variables.business_name = row.business_name;
		break;
	}
}

 

I tried same given functionality, value is not updating and also entire fields also doing empty this code