- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-07-2021 07:10 PM
Hi expert!
I am trying to remove a choice from a catalog item variable.
I have written a client script to remove the choices with the following conditions, but it does not work.
āVariable
Question |
VAR_A |
Name | t015 |
āQuestion choises
Text | test1(remove it) | test2 |
Value | 1 | 2 |
āClient Script
function onLoad() {
g_form.removeOption('t015','1');
}
However, as shown in the image below, "test" is displayed.
How can I help you?
Best regard.
senon.
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-07-2021 07:41 PM
Few things to check
1) UI Type - ALL
2) Are you using correct variable name and correct choice value
Can you try this script
function onLoad() {
g_form.removeOption('t015',1);
}
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-07-2021 07:32 PM
If this is in the Service Portal, make sure that your client-script has a UI Type selected of either All, or Mobile/Service Portal.
I hope this helps!
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-07-2021 07:41 PM
Few things to check
1) UI Type - ALL
2) Are you using correct variable name and correct choice value
Can you try this script
function onLoad() {
g_form.removeOption('t015',1);
}
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-07-2021 10:00 PM
I did not know to set the UI type to "ALL".
Now, This script is working.
Thank you Ankur!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-29-2022 12:22 AM
Hello Ankur, I tried the same. But when case gets created the category field is still visible in drop down. Can you please help me on this.