Populating empty cells in MVRS within Case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 02:28 AM
Hello,
We have a catalog item, which is using 2 MVRS and we have a requirement, that if the cell in a row is empty, we want to either completely hide it or populate it with N/A text.
How this would be achievable? Because I tried to do checks within script for catalog item, to check if field is empty, but it is still not populating.
Any other idea?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 06:20 AM
Hello @martinkruml, If you wish to replace null variables with 'N/A' then you can probably write a Catalog Client Script on Load that Applies To 'A Catalog Item' and select the desired View - Catalog Item/Request Item/Catalog Task. Here is the script
function onLoad() {
var mrvsValue = g_form.getValue('<MRVS_Name>');
if (mrvsValue) {
var obj = JSON.parse(mrvsValue);
for (var i = 0; i < obj.length; i++) {
for (var key in obj[i]) {
if (obj[i][key] === null || obj[i][key] === "") {
obj[i][key] = "N/A";
}
}
}
}
g_form.setValue('<MRVS_Name>', JSON.stringify(obj));
}
Regards,
Nishant