How to default Assignment Group and Assigned To on Create New Incident form

jlaue
Kilo Sage

Hi All -

I was wondering what is the best way to go about auto-populating the Assignment Group and Assigned To on the Incident form based on the user that is logged in.   For example, I am on the Help Desk, I take a phone call, click on Incident -> Create New, form loads - I want the Assigned To to populate as my UserID and I want the Assignment Group to default to my Default Assignment Group (I have all users set up with a default group in a custom u_default_group field).   I wouldn't want this to take precedence over Inbound Mail Actions, where I would define the Assignment Group there, or for Service Catalog -> Report an Issue, where I could define Assignment Group in that item.  

Thanks in advance!!

J

1 ACCEPTED SOLUTION

ccajohnson
Kilo Sage

Since using the Default value (even with Dictionary Overrides) is not preferrable, you can capture the default group using a Display Business rule, then setting the Assignment group and Assigned to with an onLoad Client Script:



1. Create a Business Rule to capture the Default group value:


Name: Set g_scratchpad for incident


Table: Incident [incident]


Advanced: true


When: display


Script:


(function executeRule(current, previous /*null when async*/) {


      var usrID = gs.getUserID();


      var usrObj = new GlideRecord('sys_user');


      usrObj.get(usrID);


      g_scratchpad.default_group = usrObj.u_default_group;


})(current, previous);



2. Create an onLoad Client Script:


Name: Set Assignments on Create


Type: onLoad


Script:


function onLoad() {


      if (g_form.isNewRecord()) {


              g_form.setValue('assignment_group', g_scratchpad.default_group);


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


      }


}


View solution in original post

10 REPLIES 10

Henrik Jutterst
Tera Guru

I know that this question is more then 10 mounts old but...

In this case I would use out of the box functionality for a business rule where I define what fileds should be filled out (dynamic).

  1. Create a new Business Rule that runs on desired table (Incident in this case)
  2. When to run tab: When = display (on page load)
  3. Actions tab: Assignment group: To (dynamic) One of My Groups

If the active users have more then one group, this will call for manual entry, but if the user only have one group, the correct group will be displayed.