- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 10:47 PM
Hello Everyone,
I am having requirement as if the Caller user is a member of "SNOW-L1-USERS" group then the incident should be automatically assigned to "SNOW-L2-USERS" group.
Can you please help me how can i achieve this.
Thanks 🙂
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2022 02:40 AM
Hi,
Please follow the steps below to achieve your requirement:
Below is a tested method and works correctly in my PDI for both on Change and On Load of your Caller value on Incident or any other form you want.
1) Create a Display Business Rule on your Table where the caller field is present , I am considering it is present on Incident table. So, below need to be implemented:
BR:
Type: Display
Table: Incident:
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var getCaller = current.getValue('caller_id'); // Replace "caller_id" with your caller field
var gr = new GlideRecord('sys_user_grmember_list');
gr.addQuery('user',getCaller);
gr.addQuery('group','groupSYSID here'); // pass the Sys id of group "SNOW-L1-USERS"
gr.query();
if(gr.next()){
g_scratchpad.isMember = true;
}else{
g_scratchpad.isMember = false;
}
})(current, previous);
Now write an On Change Client Script on Incident Table and use the script as below:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
if (g_scratchpad.isMember == true) {
g_form.setValue('assignment_group', g_scratchpad.GroupID);
}
return;
}
if (newValue && g_scratchpad.isMember == true) {
g_form.setValue('assignment_group', g_scratchpad.GroupID);
}
//Type appropriate comment here, and begin script below
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 11:05 PM
Hello,
1. You have to write the script include non client callable and write script so that it fetches user from that particular group.
2. Add reference qualifier on the user field. for example - javascript:new myScriptInclude().my_refqual()
.
Please refer the code to get the users from groups.
Now for the new incident.
1. Create a business rule .
2. Which runs on condition if the user is memberof that group, you can create new record on incident table and set the assignment group field with the required sysid of group you need.
Thanks
Please mark helpful and correct if applicable.
getGroupUsers : function(groupId)
{
var usersArr = [];
var groupMembers = new GlideRecord('sys_user_grmember');
if(groupId !='')
groupMembers.addQuery('group',groupId);
groupMembers.query();
while(groupMembers.next())
{
usersArr.push(groupMembers.user.sys_id.toString());
}
return 'sys_idIN' + usersArr.toString();
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2022 02:40 AM
Hi,
Please follow the steps below to achieve your requirement:
Below is a tested method and works correctly in my PDI for both on Change and On Load of your Caller value on Incident or any other form you want.
1) Create a Display Business Rule on your Table where the caller field is present , I am considering it is present on Incident table. So, below need to be implemented:
BR:
Type: Display
Table: Incident:
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var getCaller = current.getValue('caller_id'); // Replace "caller_id" with your caller field
var gr = new GlideRecord('sys_user_grmember_list');
gr.addQuery('user',getCaller);
gr.addQuery('group','groupSYSID here'); // pass the Sys id of group "SNOW-L1-USERS"
gr.query();
if(gr.next()){
g_scratchpad.isMember = true;
}else{
g_scratchpad.isMember = false;
}
})(current, previous);
Now write an On Change Client Script on Incident Table and use the script as below:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
if (g_scratchpad.isMember == true) {
g_form.setValue('assignment_group', g_scratchpad.GroupID);
}
return;
}
if (newValue && g_scratchpad.isMember == true) {
g_form.setValue('assignment_group', g_scratchpad.GroupID);
}
//Type appropriate comment here, and begin script below
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 08:35 AM
Hi Vamsi,
If your query is resolved, can you please mark the answer as correct and close this thread for others.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 05:58 AM
Why Caller ID show more User then Assignment to?