Flow to display Multi Row Variable Set for all catalog items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2025 11:26 AM
I've created a flow which uses Create Catalog Task action to take a multi row variable set and show it on catalog task, but this only works for a specific catalog item, is there a way to make this flow dynamic so it works for all catalog items with MRVS within it?
This is the MRVS added to the catalog task
As you can see, you are forced to pick a specific catalog item and map the MRVS to show it on Catalog Task, but I need to achive the same for all catalog items with MRVS so all of them use the same flow.
So far I was able to get the MRVS as json using scripting, but I dont know how to use it or display the MRVS when creating a catalog task using this method
This is the script:
(function execute(inputs, outputs) {
var reqItemGR = new GlideRecord('sc_req_item');
var catItemSysId = reqItemGR.cat_item;
var variableSets = [];
// Find variable sets linked to the catalog item
var catItemVars = new GlideRecord('item_option_new_set');
catItemVars.addQuery('cat_item', catItemSysId);
catItemVars.query();
while (catItemVars.next()) {
if (catItemVars.type == 'multi_row') {
var setName = catItemVars.name.toString();
var mrvsData = reqItemGR.variables[setName];
if (mrvsData) {
try {
var parsed = JSON.parse(mrvsData);
variableSets.push({
name: setName,
label: catItemVars.getDisplayValue('name'),
data: parsed
});
} catch (e) {
variableSets.push({
name: setName,
error: 'Failed to parse MRVS JSON'
});
}
}
}
}
outputs.mrvs_json = JSON.stringify(variableSets);
})(inputs, outputs);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2025 11:33 PM
Ideally you should do this within the Flow action itself to stay to out of the box. I will recommend this approach only.
to add MRVS on catalog task in general check this link which has script
Displaying Multi-Row Variable Sets on Catalog Tasks
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader