Assignment Group should be populate based on Caller Group

Vamsi26
Tera Contributor

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 🙂

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

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);

find_real_file.png

 

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

}

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

8 REPLIES 8

Murthy Ch
Giga Sage

Hi Vamsi,

You can achieve this using before insert BR.

 

Thanks,
Murthy

Community Alums
Not applicable

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

Sai Kumar B
Mega Sage
Mega Sage

Hi Author,

Try the below before BR

if(current.caller_id.isMemberOf('SNOW-L1-USERS')){
current.assignment_group = 'SNOW-L2-USERS';
}

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello,

You can try a assignment rule. Routing and Assignment > Assignment rule. 

ex, the oob one for vip caller is 

find_real_file.png

 

find_real_file.png

 

Please Mark as Correct or Helpful.

Regards,

Vaishnavi