How to set a limit for the choice field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 10:14 PM
Hi
How can we set a limit to select a particular choice in the choice field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 10:22 PM
Hi,
Use on load client script and make use of g_form.removeOption method to remove the choices as per your need.
Refer below link that will help you to write script
Kindly mark it correct and helpful if it is applicable.
Thanks,
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 10:27 PM
Hi Hemanth,
Are you saying based on some condition the choices should be added/removed? if you could explain in detail
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
04-14-2020 10:47 PM
Yes, i have a field name as TIME which contains choices of "10 to 12", "12 to 2" and "2 to 4".
EX: If 10 user select a choice as "10 to 12", then no others can't able to select that choice. And notification pop up message has to come that "This time slot has filled, please select another time slot. Thank you". We also get to know that we can do that with out scripting. Can you explain?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 10:01 PM
Hi Hemanth,
So you have 3 drop down choices for time-slot which user can select
Are you storing in any table which slot is open and which is filled? if yes then you can query that table with this slot and check if it is empty or filled and show alert
Use combination of Script Include and GlideAjax with onchange client script
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader