- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2024 03:33 AM
Hi team,
In interaction form on a Service Operation Workspace when assigned to changes then assignment group feild should show only the groups where assigned to user belongs to we tried to acheive through script include and onchange client script but it is not effected on form.Please Suggest if any other way we can acheive this.Thanks in advance
script include:
client script:Onchange of assined to
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2024 05:12 AM
try this
getUserGroups1: function(user) {
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', user);
gr.query();
while (gr.next()) {
groups.push(gr.group.sys_id.toString());
}
gs.log('sys_idIN'+groups.toString());
return 'sys_idIN'+groups.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
‎12-13-2024 05:12 AM
try this
getUserGroups1: function(user) {
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', user);
gr.query();
while (gr.next()) {
groups.push(gr.group.sys_id.toString());
}
gs.log('sys_idIN'+groups.toString());
return 'sys_idIN'+groups.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
‎12-11-2024 04:02 AM
Shouldn't you first select the correct assignment group, before assigning it to a specific user? It's not very common to assign to a user and then decide what group it is that should resolve it.
What if: Incident is created for application XYZ. So that ticket should be resolved by [a member of] the application support group. It's not best practice to assign to users, without assigning to the group. A user can be on holiday, on sick leave or even be on his last day with the company.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2024 05:36 AM
try this
var InteractionUtils = Class.create();
InteractionUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserGroups: function() {
var groups = [];
var userId = this.getParameter('sysparm_userId');
if (!userId) {
return JSON.stringify([]);
}
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.query();
while (gr.next()) {
groups.push(gr.group.sys_id.toString());
}
return JSON.stringify(groups);
},
type: 'InteractionUtils'
});
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('InteractionUtils');
ga.addParam('sysparm_name', 'getUserGroups');
ga.addParam('sysparm_userId', newValue);
ga.getXMLAnswer(function(answer) {
if (answer) {
var groups = JSON.parse(answer);
if (groups.length > 0) {
var filterString = "sys_idIN" + groups.join(',');
g_form.setDependentFieldFilter('assignment_group', filterString);
} else {
g_form.setDependentFieldFilter('assignment_group', "sys_idIN");
}
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2024 06:23 AM
hi @Community Alums
iam getting alert of all groups sys id but
the function setDependentFieldFilter() is not working