MRVs not showing on catalog task created from run script in wf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 12:14 PM
The below script we use to create a task for each row in the MRVs with a Run Script activity within the workflow. However, in those tasks on the variables portion the MRVs do not show but they do show on the RITM that is created. Is there something I'm missing as to why they are not showing on the tasks? I am assuming I need to add to the run script below to get them to display?
var mrvs;
var itemID = current.sys_id;
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(itemID)) {
mrvs = ritmGR.variables.client_user_information; //variable set name
//mrvs2 = ritmGR.variables.secondary_client_information; //second variable set name
}
var rowCount = mrvs.getRowCount();
//var rowCount2 = mrvs2.getRowCount();
for (var i = 0; i < rowCount; i++) {
var cattask = new GlideRecord('sc_task');
// var row = mrvs.getRow(i);
// var sd = row.client_user_first_last_name_og; //variable set column name
cattask.initialize();
cattask.setValue('request_item', itemID);
cattask.setValue('short_description', 'Client Support- ' + current.variables.client_user_information.getRow(i).client_user_first_last_name_og + ' - ' + current.variables.client_user_information.getRow(i).client_users_email_address_og);
cattask.setValue('assignment_group', '38dd3c4bdb742748ca467b6b8c9619c3'); //LC-Client Support
cattask.insert();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 12:31 PM
You can follow below article to show MRVS:
Multi row variable set (MRVS) not visible in catalog task
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 12:35 PM
Hello,
Please try this
Hi,
You can write below script in business rule to display MRVS variables and their values in catalog task variable editor
But make sure you give the item as your item in condition and write your BR on catalog task table
(function executeRule(current, previous /*null when async*/) {
// Copies the values from a multi-row variable set into a variable so we can view the values on a catalog task.
var variables = [];
var catItem = current.request_item.cat_item.toString();
var variableSets = [];
var getVariableSets = new GlideRecord('io_set_item');
getVariableSets.addQuery('sc_cat_item',catItem);
getVariableSets.query();
while(getVariableSets.next()) {
variableSets.push(getVariableSets.getValue('variable_set'));
}
var getCatalogVariables = new GlideRecord('item_option_new');
var qry='cat_item='+catItem
+'^active=true'
+'^NQvariable_set.sys_idIN'+variableSets.toString()
+'^active=true';
getCatalogVariables.addQuery(qry);
getCatalogVariables.query();
while(getCatalogVariables.next()) {
variables.push(getCatalogVariables.getValue('sys_id'));
}
var variablesCount = variables.length;
var currentTaskID = current.sys_id.toString();
for(var i=0;i<variablesCount;i++)
{
var getTaskVars = new GlideRecord('sc_item_variables_task');
getTaskVars.addQuery('task',currentTaskID);
getTaskVars.addQuery('variable',variables[i]);
getTaskVars.setLimit(1);
getTaskVars.query();
if(!getTaskVars.hasNext())
{
getTaskVars.initialize();
getTaskVars.setValue('task',currentTaskID);
getTaskVars.setValue('variable',variables[i]);
getTaskVars.insert();
}
}
})(current, previous);
Please mark my answer helpful if it solves your issue

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 12:44 PM
Hey Mohit, how is your response is different from mine?
Also, I would request not to just copy and paste someone else's response and work, feel free to refer to links but copy and pasting is just plagiarism.
Hope you take it in the right spirit, just a suggestion!
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 12:46 PM
Hey Aman,
Thanks for the suggestion but I copied the link too above the script for the reference and i did not notice that you pasted the same link!
Hope you understand