updating MRVS variables data in RITM

venkat_guthik
Tera Guru

Hi... I have converted one normal reference field 'control' to multiple references... so, i  used multirow variable set and changed the field.
Example: when we select one control(reference filed). it will auto populate control number and control objective.

for this i created cataiog client script and one script include and populated data correctly on catalog form. after ritm creation variables displaying correcly in MRVS.

venkat_guthik_0-1712918538286.png

when iam passing control sysid through postman application i can get only control details, remain two fileds are coming null values. 

venkat_guthik_1-1712918642794.png

Now i want to update those two mrvs fields data after RITM request creation using after insert business rule.
How can i write the business rule and populate data correctly on RITM , please help anyone.

2 ACCEPTED SOLUTIONS

Brad Bowman
Kilo Patron
Kilo Patron

In a Business Rule on the sc_req_item table, you can get/set the value of a MRVS using current.variables.mrvs_internal_name, so you can either replace the value with all three variables as it sounds like you were trying to do through postman, or get the value, then loop through each row updating the variables like this:

var mrvs = current.variables.mrvs_internal_name; //your MRVS name
var rowCount = mrvs.getRowCount();
for (var i=0; i<rowCount; i++) {
	var row = mrvs.getRow(i);
	row.v_mrvs1_model = "Dell 17 inch Monitor"; //mrvs variable name and value
	row.v_mrvs1_class = "Peripheral";
}
current.update(); //only if running the Business Rule AFTER insert or update

 

View solution in original post

Hi Brad,

Thanks for your reply.

View solution in original post

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

In a Business Rule on the sc_req_item table, you can get/set the value of a MRVS using current.variables.mrvs_internal_name, so you can either replace the value with all three variables as it sounds like you were trying to do through postman, or get the value, then loop through each row updating the variables like this:

var mrvs = current.variables.mrvs_internal_name; //your MRVS name
var rowCount = mrvs.getRowCount();
for (var i=0; i<rowCount; i++) {
	var row = mrvs.getRow(i);
	row.v_mrvs1_model = "Dell 17 inch Monitor"; //mrvs variable name and value
	row.v_mrvs1_class = "Peripheral";
}
current.update(); //only if running the Business Rule AFTER insert or update

 

Hi Brad,

Thanks for your reply.