How to set an incident to automatically asign to specific group when the user have role

Krivi
Tera Contributor

Hi all

 

Can anyone help me to resolve this issue please.

When an user login to ServiceNow support portal to create an incident . If the user is a member of group called X and have role called XY then assignment group auto assign to Service consultant group.

I used below business rule but its not worked.

Krivi_1-1740143571153.png

 

Also try to create an Assignment rule for this that's also not work.

 

 

2 ACCEPTED SOLUTIONS

Kieran Anson
Kilo Patron

If you do decided to use an assignment rule, it runs in the user context so you can use the GlideUser API. This is assuming you're wanting to check the user logging the ticket, not the caller (as they could be different if the user is raising on behalf of someone.

 

(function(current, gs) {

    if (!gs.getUser().hasRole('XY_ROLE'))
        return;

	if(!gs.getUser().isMemberOf('GROUP_NAME_OR_SYS_ID'))
		return;

	//They have the role and group
	current.setValue('assignment_group' , 'sys_id_of_group'); //pull the group from a system property;

})(current, gs)

 

 

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@Krivi 

you can either use before insert business rule or assignment rule

business rule condition:

Use Actions tab and set the group

AnkurBawiskar_1-1740144546961.png

 

AnkurBawiskar_0-1740144510605.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Kieran Anson
Kilo Patron

If you do decided to use an assignment rule, it runs in the user context so you can use the GlideUser API. This is assuming you're wanting to check the user logging the ticket, not the caller (as they could be different if the user is raising on behalf of someone.

 

(function(current, gs) {

    if (!gs.getUser().hasRole('XY_ROLE'))
        return;

	if(!gs.getUser().isMemberOf('GROUP_NAME_OR_SYS_ID'))
		return;

	//They have the role and group
	current.setValue('assignment_group' , 'sys_id_of_group'); //pull the group from a system property;

})(current, gs)

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Krivi 

you can either use before insert business rule or assignment rule

business rule condition:

Use Actions tab and set the group

AnkurBawiskar_1-1740144546961.png

 

AnkurBawiskar_0-1740144510605.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Krivi 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader