How to get List of possible options on choice variable field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 06:02 AM
HI,
I have a select box variable and 'remove' some options via a catalog client script on load.
Now I need to be possible to list the remaining "possible" options via a catalog client script.
How to?
Was was hoping it works this way ...
var values = [];
var sel = g_form.getElement('<variablename>');
for (var i=0, n=sel.options.length;i<n;i++) {
gs.info(sel.options[i].value);
}
.. but this seems not to work.Type Error ... "sel is undefined" ...
Any idea?! Thank you!
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 08:19 AM
Forgot to think about service portal. However I'm still not sure why you want to try and get what is still available after doing remove option.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 10:37 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 01:33 PM
I'm not sure. As using the script other then not working on service portal looks a the variable and it options. It does not know that a another script removed some options so it will still return all of them to you. Is there no way to know from your script the removes options that it removed all but one? Since you know how many you start wouldn't you be able to tell how many got removed? If you could then you would be able to also do a g_form.removeOpation('variablen name', '') which would remove the none default it to the only thing in the list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2020 04:03 AM
performance wise not really an option to go ... at least does not look like a professional way to go ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2021 09:00 AM
For anyone looking to get the choice options available for a field that is supported by (Catalog) client script and works in Service Portal/Mobile: