Is it possible to use a user group as a reference qualifier?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 01:51 PM
Greetings, everyone.
Long story shot: I have a few "Reference" fields, of which the reference is the "user
" table, and I'm wondering if it would be possible to use user groups (not departments or companies) as the reference qualifiers of these "Reference" fields.
Any help would be greatly appreciated!
- Labels:
-
Scripting and Coding
-
Studio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 01:55 PM
You can utilize script include to either return the sys_id or complete filter to filter out records in reference qualifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 01:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 01:59 PM
Hello.
Here's an example for the exact requirement:
- Field label: "Administrative Assistant"
- Reference table: "
user
" - User group: "Administrative Assistant"
- Requirement: I must be only allowed to select one of the members of the "Administrative Assistant" user group for the "Administrative Assistant" field.
Did that make sense?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 02:10 PM
You can call a script include for this in the advanced reference qualifier like below
javascript:new yourscriptinclude_name().your function_name()
Script include:
Must be non client callable script include
Your_function_name :function()
{
var arr=[];
var gr= new GlideRecord('sys_user_grmember');
gr.addQuery('group','your group sys id');
gr.query();
while(gr.next())
{
arr.push(user.toString());
}
return 'sys_idIN'+arr.toString();
Hope this helps
MARK MY ANSWER CORRECT IF THIS HELPS YOU