The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Assignment Rule scripting for assigning to a person and a group for a particular item

Thomas G
Tera Guru

Hi,

I have an Assignment Rule that assigns different items to an Assignment Group. If one of those items is a particular one, I need not only to assign it to a group, but to a person within that group. I could just make a new Assignment Rule for that particular item, but I have a lot of them already and guess that I can use scripting in the one already assigning items to the group in question. Can anyone help me with a script?

Best regards
Thomas

8 REPLIES 8

Thanks for the script!!

This script is only executing when new record is inserted and if i try to updating the record it is in same data.

 

 

In this screenshot i tried to change the category to hardware so after saving the record... But assignment is still in Help Desk.

Can you please help me with that..

@Jeevanantham 

If the Assignment group is already populated then the Assignment rule will not overwrite it.

Refer https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/task-table/c...

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Thomas G
Tera Guru

Thanks for your reply,

The Assignment Rule in question has already the group set under the 'Assign to' tab. I was hoping that I could just ad a script (under the script tab) telling ServiceNow that if you see this item then assign it not only to the group already selected, but to this particular person within that group. Do I still need to set the Assignment Group in the script?

Best regards
Thomas

 

 

Hi Thomas

You can add your conditions in script part as below, let us know more about requirement so that we can help you with code.

sample logic for assignment using script based on conditions.

if(current.<<field_name>> == 'xyz'){
               current.assignment_group = 'group sysid'; 
                current.assigned_to = 'assignedto_user_sysid';
}else
{
   current.assignment_group = 'group sysid'; 
    current.assigned_to = 'assignedto_user_sysid';
}

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP