- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 06:52 AM
In our Service Center, we have a Select Box variable with hard-coded dates.
Here is the variable definition. It is a Select Box with Question Choices. That is where the dates are hard-coded.
We want to remove dates that are 35 days or less. My idea is to set up a catalog client script, iterate through the question choices (like an array), convert each string to a date and compare with today's date. If that date is equal to or less than 35 days, then I could remove that date such as this...
g_form.removeOption('field_name','choice_value');
What would be the code to iterate through the question choices of a Select Box variable?
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 07:11 AM
There's two options you can try that will potentially let you do it client side.
Otherwise, if that does NOT work, Option 3...you can always use GlideAjax to access a server script where you can query the "Question Choice" table, and return the list of values you could then loop thru and removeOption.
Let me know if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 08:46 AM
I got this to work. I went with the Script Include, and was able to remove question choices in the catalog client script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 09:55 AM
Hi,
Glad you got it figured out. GlideAjax is the better option compared to getReference anyway, so there's another win for it.
Take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 06:50 AM
Can you please elaborate?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 12:29 PM
This was an old question on the forum, over a year ago. This is already solved. I set up the code using a script include, and pulled it in through Catalog Client Script.