Populate Assignment Group & Assigned To based on the logged in user and their Primary Group

RichardSaunders
Tera Guru

I need to be able to populate the Populate Assignment Group & Assigned To for service desk staff only. This should not happen to users using the self service portal.

I have experimented with default value: javascript:gs.getUserID() and assignment rules but can not get it working.

any advise/pointers?

1 ACCEPTED SOLUTION

Is this what you are looking for with an onLoad client script?



function onLoad() {


//Type appropriate comment here, and begin script below


var grp = g_form.getValue('assignment_group');


if (grp == ''){


var userName = g_user.userName;//logged in user



var gr = new GlideRecord("sys_user");//check if the logged in user has a primary group


gr.addQuery('user_name', userName);


gr.addQuery('u_primary_group', '!=', '');


gr.query();


if (gr.next()){//logged in user is a member of assignment group


g_form.setValue('assignment_group', gr.u_primary_group);


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


}


}


}


View solution in original post

20 REPLIES 20

The assigned to and assignment group should populate onLoad before the record is saved or submitted, The assignment group should be the same as the Primary Group (u_primary_group) field set on the User (sys_user) table. If no primary field is set, the form would not pre-populate.


Is this for raising a new record? Or looking at an existing one?



I'm a tad worried about the implications of this rule. It would honestly frighten me off the idea of opening tickets for fear I suddenly gain ownership.


Hi Dave, Yes this is only for on load of a new record for the service desk only. Just saving them the repetition of completing two extra fields.


Okay, well you have a number of options:


  1. use templates. It'll pre-fill some fields for them, but involves staff actually selecting them
  2. use a BR to backfill the fields if they're left blank. This requires a record save, so won't be displayed until "Submit" (or "Save")
  3. use a UI Policy... but it could kick in for ALL users, not just those whom belong to a specific group
  4. A onLoad script (mentioned above).


However, this doesn't feel like the right policy to me...the service desk is supposed to log tickets then assignment rules to auto-assign the ticket based on specified criteria.   This way, you're auto-assigning every ticket to the agent who created the ticket, negating autoassign rules.



Basically, it'll do what you want it to... but I'm merely questioning if this is the right thing to do.


Thanks Dave,



We have gone with ndt13's suggestion, the onLoad client script.



It is the right thing to do.. For us anyway.



6103 tickets were raised last month were first line fixed (64%) so auto populating these assignment fields onLoad will be productive to the desk.


Selecting a different product or service will still populate the assignment fields onChange.


Good stuff!   That's not a bad first-time fix rate, and I agree that anything helping the SD can make them more productive.



As a matter of interest... how many of those 6K tickets were raised by the SD, compared to self-service?