- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 05:21 AM
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
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 05:37 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 05:37 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2021 12:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 06:11 AM
Hi,
Can you share the screenshot of NewYork and Paris comparision
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 06:32 AM
Dear Ankur,
Currently I don't have any New York instance.
It seems that in the New York release the 'sc_item_variables_task' table were automatically updated when the SCTASK was inserted, for both 'normal' variables and 'MRVS' variables.
With Paris the 'sc_item_variables_task' is not automatically updated, but:
- 'normal' variables are linked to SCTASK only if 'Global=true' in their definition
- 'MRVS' variables are not linked to SCTASK at all
Sutot