set visible in variable set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 12:06 AM - edited 05-14-2025 12:08 AM
Hi Everyone,
I have a requirement where on the catalog item,
there are two custom fields in multi row variable set called select choice and application tag -
when a Type B is selected in choice field on the catalog form from choice field
field in the variable set select choice should be visible with the choice azure and on prem.
and only when on prem is selected another field called application tag should be visible (in variable set).
I am new to variable sets can anyone help me out here please.
how shall I achieve this?
thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:04 AM
Your original requirement was different
But if you want to hide the variable within MRVS based on outside variable value then do this
Ensure you give correct choice value to compare and correct variable name
function onLoad() {
//Type appropriate comment here, and begin script below
var applicationType = g_service_catalog.parent.getValue("this_is_regarding");
if (applicationType == 'type B') // give the choice value to compare
g_form.setDisplay('selectChoiceVariableName', false);
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:15 AM - edited 05-14-2025 02:16 AM
no actually this is req
I want to hide the variable inside the variable set depending on the variable outside of the variable set.
have tried with same script but still same issue its showing for every choice field.
given below :
backend name for choice field is 'select_choice'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:26 AM
what came in alert? share that
function onLoad() {
//Type appropriate comment here, and begin script below
var applicationType = g_service_catalog.parent.getValue("this_is_regarding");
alert('applicationType' + applicationType);
if (applicationType == 'type B') // give the choice value to compare
g_form.setDisplay('selec_choice', false);
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:30 AM
sure ,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:40 AM
Hi @tushar_ghadage ,
function onLoad() {
//Type appropriate comment here, and begin script below
var applicationType = g_service_catalog.parent.getValue("this_is_regarding");
alert('applicationType' + applicationType);
if (applicationType == 'type_b') // give the choice value to compare
g_form.setDisplay('selec_choice', false);
}check the backend value of the Type B choice and update it in the if condition if needed
I have just corrected choice value based on your screenshot
addition to @Ankur Bawiskar's post
accept his post a as a solution and give a like to mine
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
