- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 08:39 PM
I want to Hide a Variable (state_name) which exists in a Multi row Variable set for a specific catalog item. I've tried set display, setvisible by writing a onload and ui policy scripts. but it wo'nt worked. Any one have any idea to hide variable in MRVS for specific cat item.. this requirement is little bit urgent..
Thank you in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 08:57 PM
You can try something like below in MRVS client script:
function onLoad() {
//Type appropriate comment here, and begin script below
function getParameterValue(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(top.location);
if (results == null) {
return "";
} else {
return unescape(results[1]);
}
}
var catSysId = getParameterValue('sys_id');
if (catSysId == "7198552237b1300054b6a3549dbe5dea") { //replace with your cat item sys_id and variable name
g_form.setDisplay('device_type', false);
}
}
(=tested)
Murthy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 08:50 PM
Hello @Aditya02 ,
Using a Catalog Client Script
Create a Catalog Client Script:
Navigate to Service Catalog > Catalog Definitions > Maintain Items.
Open the catalog item where the MRVS is used.
Scroll down to the Related Links section and click on New under Catalog Client Scripts.
Use the g_form.setVisible() method to hide the variable. However, since MRVS variables are slightly different, you need to target them correctly.
Example script
function onLoad() {
// Check if the catalog item is the specific one
if (g_form.getValue('sys_id') === 'your_catalog_item_sys_id') {
// Hide the variable in the MRVS
var mrvsField = g_form.getControl('multi_row_variable_set_name.variable_name');
if (mrvsField) {
mrvsField.style.display = 'none';
}
}
}
Kindly mark this as correct if this helps you and close this thread so it helps other users and motivates me for helping more.
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 09:39 PM
hello @Debasis Pati ,
I've tried this, but still the field is visible. and I came to know that,
- It will return null because g_form.getControl() doesn't directly support accessing variables inside an MRVS.
- g_form.getControl() works for top-level variables, but it doesn't always find nested variables inside MRVS rows because MRVS fields are handled differently (dynamic rows rendered by the widget, not by standard form fields).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 08:51 PM
Hi @Aditya02,
Please create a UI policy without a condition on your catalog item.
in your UI policy action, you can create one for the variable on your variable set and then set its visibility to false.
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 09:16 PM
Hi @Medi C ,
I tried that also.. but i can able to see internal variables inside the MRVS.. I can see only the Variable set name.