Script to Set assignment group for record producer

Nolan3
Mega Guru

Hello,

I am trying to figure out how to set the default assignment group on a particular record producer.   Ideally, the script would be as simple as setting the assignment group to our service desk whenever that piratical record producer is used to create the record.     I see where I can add a script to the record producer just not sure, how the script can be set to look at the name of the record producer and set assignment group or if that is the correct way to approach it.

Here is my attempt at doing this but the part I am not sure how to script is what I have in bold.  

if(producer.name.getDisplayValue == 'Submit a Request to IT(RP)')

{

        current.assignment_group = 'sys_id of the group';

}

Disclaimer:   I am a service now administrator of our instance but I am not a programmer and after searching the community I couldn't find a script that I could adapt to my needs.

I appreciate any help someone could provide.  

Thanks,

Nolan

1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

If you're using the script field in the record producer, you can just use the following to set the assignment group:


        current.assignment_group = 'sys_id of the group';


View solution in original post

6 REPLIES 6

Hi Michael, 

This helps but when I move the code from dev to test , it is not working. as the sys id of the assignement group changes in each instance. 

You can try using the line below if the display names are the same in dev and test.

current.assignment_group.setDisplayValue('<group_name>');