Populate only required groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
Hi Community,
For one of the catalog items, we have a variable named "groups", and the available choices for this variable are maintained in the question_choice table. The variable type has been set to List Collector, with the List Table configured as question_choice.
The groups variable should display choices based on the selection of another variable, "xyz". To achieve this, we implemented a Script Include and referenced it in the Reference Qualifier for the groups variable.
However, when the form is opened in the Service Portal, before selecting the xyz variable, the groups variable displays all choices from the question_choice table, including those created for other catalog items. The expected behavior is that the groups variable should only display choices associated with the current catalog item.
How can we ensure that the groups variable only shows choices specific to this catalog item in the question_choice table?
Reference qualifier in group variable : javascript: new SobeysKhalixAccessRequest().KhalixAccessRequest(current.variables.xyz)
Can anyone please help how to achieve this ?
Regards,
Tulasi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
Hi @tulasi8,
is there any special reason why the variable is getting values from question_choice? It could be linked directly to the Groups table with applied reference qualifier:
I believe that would be easier maintenance than to create, edit, and remove groups in question_choice..
No AI was used in the writing of this post. Pure #GlideFather only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
@GlideFather It's created by some others in the instance . I donno why they used "question_choice" here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
You can add a field on the question_choice table to check if the record can be displayed on the catalog item or not. Then , you can add a simple condition in the reference qualifier to filter out.
Can you also elaborate more on the another variable, "xyz" . what relation does it have to be with the 'groups' field?
Mark my response as helpful if it has helped you.
Regards,
Nayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
question_choice doesn't store any info about the catalog item associated to it.
you need to handle this in script to bring the question_choice associated to current catalog item
-> pass the catalog item sysId and then use that in your script include
javascript: new SobeysKhalixAccessRequest().KhalixAccessRequest(current.variables.xyz, 'itemSysId')
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader