Multi row variable set (MRVS) not visible in catalog task

sutot
Tera Contributor

Hi all,

I have a catalog item with a MRVS (called u_tokens) and I want to display it in the corresponding RITMs and SCTASKs.

Before it was ok, but after the upgrade from New York to Paris, the MRVS is not displayed in the SCTASK form.

After some investigation, I realized that:

1. MRVS variables cannot be set as 'Global'

2. UI policy 'Visible' action does not work with MRVS (see UI Policy.png attachment)

3. If the SCTASK is created by using a 'Catalog task' activity in the workflow editor, all MRVS - if selected - are correctly displayed in the SCTASK form (see Catalog task activity.png attachment).

Applying the point 3 would resolve my issue, but unfortunately I have a lot of workflows and business rules that create SCTASKs via script. Do you have any idea how can I resolve my problem? Is there some command I can use in scripts to make MRVS visible in tasks?

Thank you,

Sutot

 

1 ACCEPTED SOLUTION

Suseela Peddise
Kilo Sage

Hi,

You can write below script in business rule to display MRVS variables and their values in catalog task variable editor

 

(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);

 

If I have answered your question, please mark my response as correct and/or helpful.

 

Thanks,

Suseela P.

View solution in original post

10 REPLIES 10

Sowmya39
Tera Contributor

Was anyone able to get a solution for this issue?