How to copy/print MRVS (Multi row variable set) values to catalog task description?

Ronak3
Tera Contributor

Hi Community,

My catalog item contains MRVS which contains reference (application to select), select box & text variables. How do we copy these values selected onto the catalog task description? 

Tricky part is, Each row with different reference variable selected will create a catalog task per row . There can be multiple tasks generated. And that catalog task description should contain only that row variable values.

1 ACCEPTED SOLUTION

A script like this should get you close.

var mrvs = current.variables.mrvs_internal_name;//replace with the internal name of your MRVS
var rowCount = mrvs.getRowCount();
for(var i = 0; i < rowCount; i++){
  var row = mrvs.getRow(i);	
  var app = new GlideRecord('cmdb_ci_business_app');//replace with the reference table name of your MRVS application reference variable
  app.addQuery('sys_id', row.v_mrvs_application);//replace with the name of your MRVS aplication reference variable
  app.query();
  if(app.next()){
    if(app.assignment_group == task.assignment_group){
      task.description = 'some text ' + row.v_variable1_name + ' some more text ' + row.v_variable2_name;
    }
  }
}

View solution in original post

8 REPLIES 8

A script like this should get you close.

var mrvs = current.variables.mrvs_internal_name;//replace with the internal name of your MRVS
var rowCount = mrvs.getRowCount();
for(var i = 0; i < rowCount; i++){
  var row = mrvs.getRow(i);	
  var app = new GlideRecord('cmdb_ci_business_app');//replace with the reference table name of your MRVS application reference variable
  app.addQuery('sys_id', row.v_mrvs_application);//replace with the name of your MRVS aplication reference variable
  app.query();
  if(app.next()){
    if(app.assignment_group == task.assignment_group){
      task.description = 'some text ' + row.v_variable1_name + ' some more text ' + row.v_variable2_name;
    }
  }
}

Hi Brad,

Forgot to mark your answer as correct as it was helpful for me to get the mrvs values that belongs to each catalog task. 

 

Thank you!

You are welcome!

Hi Brad,

I have got an issue with the code in the business rule to obtain phone number from a text field containing other characters, I have posted the below question on community for the same.

https://community.servicenow.com/community?id=community_question&sys_id=e8f773381b33a4107a5933f2cd4bcb8b

 

Could you please let me know how to get such phone number / email from the text field and append the domain name and send email (this I have done with event and added domain name to the field value in business rule).