- 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 10:53 PM
Hi Vamsi,
You can achieve this using before insert BR.
Murthy
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 10:54 PM
Hi Vamsi,
The user can belong to multiple groups so how you can auto-populate the group based on user's group?
You can refer to this thread:
https://community.servicenow.com/community?id=community_question&sys_id=cc52403cdb3ca78054250b55ca961992
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 10:59 PM
Hi Author,
Try the below before BR
if(current.caller_id.isMemberOf('SNOW-L1-USERS')){
current.assignment_group = 'SNOW-L2-USERS';
} 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 11:01 PM
Hello,
You can try a assignment rule. Routing and Assignment > Assignment rule.
ex, the oob one for vip caller is
Please Mark as Correct or Helpful.
Regards,
Vaishnavi
