- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 12:41 AM
Hello All,
We have a requirement where, on the catalog form, if the Line of Business field value is selected, the SVP/VP reference field should filter and display the relevant names based on the selected value, allowing the user to choose from the options.
Currently, we have written a script include that displays the group members of the selected Line of Business in the reference field. However, in the client script, we are using the setValue method, which sets all member names to the field instead of providing a filter option for user selection.
To achieve the functionality where users can select from a filtered list, what changes should we make to the following client script?
var ga = new GlideAjax('JobGroupMember');
ga.addParam('sysparm_name', "getMembers");
ga.addParam('sysparm_organization', line);
ga.getXMLAnswer(callback);
function callback(response) {
var answer = JSON.parse(response); {
g_form.setValue("svp", answer.join(','));
}
}
}
Any help will be appreciated.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 01:57 AM
is group name variable or organization variable a string type or a variable
if it's string holding group name then update your script include function as this
getMembers: function(groupName) {
var users = [];
var members = new GlideRecordSecure('sys_user_grmember');
members.addQuery('group.name', groupName);
members.query();
while (members.next()) {
var mates = members.user.sys_id.toString();
users.push(mates);
}
return 'sys_idIN' + users.toString();
}
},
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
‎01-06-2025 04:50 AM
you didn't answer my question
is group name variable or organization variable a string type or a variable?
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
‎01-06-2025 05:03 AM
@Ankur Bawiskar,
organization field is a variable, type : Select Box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 04:59 AM
you are using GlideRecorSecure so did you check the user with whom you are testing has read access to that sys_user_grmember table?
Did you try with GlideRecord?
Did you try with admin role with GlideRecordSecure?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 05:07 AM
I tried, GlideRecord but it didn't work. Same logs are printed filter data is not displayed in the reference variable.
Also i didn't impersonate any one and check as i'm not able to see the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 05:09 AM
please share the choices configured for that variable
organization field is a variable, type : Select Box.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader