The CreatorCon Call for Content is officially open! Get started here.

How to edit assign to me button in agent workspace and add some rules to it?

rahul16
Giga Guru

‘Assign to Me’ button shows up on all New tickets right now. Clicking on it simply assigns the Incident to the current user irrespective of the Assignment group selected on the ticket

We should either -

i. Not show this button if the current user is not a part of the ticket’s assignment group.

ii. Give an error message letting the user know that the ticket cannot be assigned to them as they’re not a part of the group.

find_real_file.png

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

Hello,

In the UI action "Assign to me", just add the below condition then ti will only show if the user is a part of the group:-

gs.getUser().isMemberOf(current.assignment_group.toString())

find_real_file.png

Please mark answer correct/helpful based on Impact

View solution in original post

17 REPLIES 17

Hello,

I am glad you you got the final output. You can mark any of my answer correct/helpful based on Impact

 

Also I answered another of your query as well in the below thread can you mark my answer as correct on this thread as well:-

https://community.servicenow.com/community?id=community_question&sys_id=423edf5bdb910550dd886c8e1396190a

can you take a look into this thread as well please - https://community.servicenow.com/community?id=community_question&sys_id=6034fd1fdb158d1007ab82630596193f

Sanjay Bagri1
Tera Guru
Tera Guru

Hi Rahul,

 

Before edit the Assign to me button you have to select the correct application then you will be able to save the condition.

 

Thanks 

Sanjay Bagri

The condition is working fine but what I want is to Give an error message like letting the user know that the ticket cannot be assigned to them as they’re not a part of the group.

Use this below code: 

 

Unchecked Client Checkbox and try with below code:

if(gs.getUser().isMemberOf(current.assignment_group))
 {
 current.assigned_to=gs.getUserID();
  
 }

 else
 {
 
	gs.addInfoMessage('Looged-in user is not a member of the selected Assignment Group');
 	gs.addInfoMessage('select in assign to');

 }

action.setRedirectURL(current);
current.update();