- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 02:38 AM
I need to display 2 extra variable fields on the selection of a Selectbox variable choice in Catalog Item. For example the the catalog item has a Select box variable with 3 variable choices A , B, C. On selection of B, two new variables should be displayed on the form and on selection of A or C these variables should diasappear from the catalog. Is there any method to achieve this? I am fresher in ServiceNow and have been assigned with this task. Please explain in a way a fresher can understand.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 02:47 AM
Hi Anu,
Welcome to ServiceNow world. Hope you like the ecosystem!
Coming to your question, you can create Catalog UI policies.
In your Catalog UI policy condition, you can mention your Select Box condition:
Ex: Select Box value is A OR Select Box value is C.
Then you can scroll down to the related list UI Policy Actions. There you can click on 'New' and select your field to be made visible and then mark the Visible checkbox as true.
You can do the same for another condition: Select box value is B and create UI policy action for it.
You can try it and let me know if you face any issues.
You can mark my answer as correct/helpful depending on its impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 02:56 AM
Hello @Aju Sam ,
You can try Onchange catalog client script to make the variables visible only if the ChoiceB is selected
if (g_form.getValue('Variablename') == 'ChoiceB') {
g_form.setVisible('Variablename1', true);
g_form.setVisible('variabename2', true);
} else {
g_form.setVisible('Variablename1', false);
g_form.setVisible('variabename2', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 02:47 AM
Hi Anu,
Welcome to ServiceNow world. Hope you like the ecosystem!
Coming to your question, you can create Catalog UI policies.
In your Catalog UI policy condition, you can mention your Select Box condition:
Ex: Select Box value is A OR Select Box value is C.
Then you can scroll down to the related list UI Policy Actions. There you can click on 'New' and select your field to be made visible and then mark the Visible checkbox as true.
You can do the same for another condition: Select box value is B and create UI policy action for it.
You can try it and let me know if you face any issues.
You can mark my answer as correct/helpful depending on its impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2023 02:56 AM
Hello @Aju Sam ,
You can try Onchange catalog client script to make the variables visible only if the ChoiceB is selected
if (g_form.getValue('Variablename') == 'ChoiceB') {
g_form.setVisible('Variablename1', true);
g_form.setVisible('variabename2', true);
} else {
g_form.setVisible('Variablename1', false);
g_form.setVisible('variabename2', false);
}