Tree Picker - prevent the parent options to be selected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 09:55 PM
Hello! I have this requirement where only options of a tree picker without a child option can be selected. Kindly see the example below:
In this case, only the highlighted options are allowed to be selected. Do you have any ideas on how I can implement this?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 10:54 PM
you need to have advanced ref qualifier for this with script include and return the sysIds of record which don't have any child
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-22-2024 12:18 AM
Hello @Ankur Bawiskar,
Thanks for your answer. I still need the parent options to be displayed from the tree picker and just want to prevent them from being selected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 12:30 AM
what's the point in showing and then running validation?
Why not simply hide those using advanced ref qualifier?
If you want to show and don't want them to select then do this
1) write onChange client script on that field and using GlideAjax verify if this is a parent or child
2) based on that show alert and clear the field
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-22-2024 12:47 AM
It's to show the which group the child option belongs to. It's like <optiongroup> element in HTML.
Yes, I've already done the items you've suggested but we still need to look for ways to prevent the parent option from being selected as this is really our ideal scenario. I appreciate your replies to my post. Thank you very much!