- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2017 09:33 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2017 10:29 AM
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);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2017 10:08 AM
Hi Jason,
For the Service Catalog record producer, you dont know, what will be the assignment group. But if you have a default group you want to set it to, you can use the script field and set it to current.assignment_group = 'the group sys_id';
For email, use inbound email script to set it . current.assignment_group = 'group sysid'
On the form you can use onLoad client script to populate the assignment group and assigned to.
Use g_form.setValue('assigned_to',g_user.userID);
To get the assignment group, perform glideajax and pass g_user.userID
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2017 10:15 AM
you could do an onload client script and a Script inlcude. Use glideAjax to call your script include and have it pass back the "default assignment group" value. then you can set assignment group on the incident form. you can use g_user object to set the assigned to.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2017 10:29 AM
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);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2017 11:41 AM
Thanks Christopher for the detailed explanation and the code! I am getting the Assigned To to pass through OK, it is not bringing through the Assignment Group, but that may be due to a UI policy on that field or something like that, so I am tinkering with that right now.
Thanks again!
J