Default Assignment Group

ljschwaberow
Giga Expert

We have several groups, that we use for workflows and change request forms, in our ServiceNow instance that have the same users and we are wanting to have a default group set up for each user. That way when they fill out change request forms or are filling out an incident a specific group will always populate the same group. I have added a 'Default Group' true/false field to the list under each group and have set those individuals to true. However, I am assuming I would need to set a default value for the assignment_group field on the task table to pull the group with default group = true. However, I'm not quite sure what needs to be entered.

find_real_file.png

18 REPLIES 18

Your best bet for this solution is to set the Assigned to field via an onLoad client script.   With this solution you can control when the Assigned to is populated.   For example, if the opened by user has the ITIL role for example.   By setting a default value at the dictionary level you are basically saying that I always want this field populated this way.


Thanks Brad, that makes sense - although I have realised it cannot be role based as we may have e.g. IT staff working remotely logging genuine tickets via e-mail (which would then be assigned to themselves where ordinarily the auto-assignment rules would send it to the service desk).



I was thinking maybe we could set it where contact type is not e-mail to then automatically populate with the Opened by user.



In this instance what type of script would best, an onLoad or onChange? Would it look anything like this?



if (g_form.getValue('contact_type') != "email")


{


g_form.setValue('assigned_to', "javascript:gs.getUserID()');


      }



Any help much appreciated, I am new to scripting as the above no doubt illustrates.



Cheers,


Daniel


I see what you are saying but if 90% of the time they want it assigned to themselves then that means that they would only need to clear out the assigned to field 10% of the time.   Your script below is a great idea because it will only set the value if the contact_type is not equal to email.   One other check we should do is check the assigned_to field and make sure that it isn't already populated.   Try this:


if (g_form.getValue('assigned_to') != '' && g_form.getValue('contact_type') != 'email') {


  g_form.setValue('assigned_to', g_user.userID);


}


Thanks Brad, just had to take the first ! out and put another = in as wanted it to check where the assigned to does equal empty. Your help is much appreciated.



Cheers,


Daniel