Set the assignment group base on UI action

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2009 02:37 PM
I am trying to update the assignment group filed on the incident form when user click on a UI action button. The button will only appear if the incident state is not set to close and user has a specific role. By clicking on the button following should happen;
Incident state sets to close , which it does
Assignment group sets to "Help Desk" regardless of what it was already populate it with. which it does work at the time. I have used the following methods, but non of them have worked so far.
current.incident_state = 7;
current.assignment_group.setDisplayValue("Help Desk");
if(current.isValidRecord()) {
// this is when close is called as an update, just update it
current.update();
} else {
// and insert the record
current.insert();
}
current.assignment_group = current.assignment_group.setDisplayValue("Help Desk");
current.assignment_group = GetIDValue('sys_user_group', 'Help Desk');
Any idea why this is not working, or have anybody done this before?!
I appreciate any commend or feedback.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2009 09:59 PM
I think you want the
method not
.getDisplayValue()
.setDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2010 08:40 AM
I have a similar issue to this and i dont know why my script is not working ;-(. I have an accept button which autofills the assignee to the user logged in but also should autofill the assignment group which that user belongs too. This is my script below i used in the UI action
current.assigned_to = gs.getUserID()
var assign = g_form.getValue('assigned_to');
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', assign);
gr.query();
gr.next();
current.assignment_group = current.assignment_group.setDisplayValue(gr.group);
Please help, the customer has been complaining to get this working.
Your help is much appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2010 09:06 AM
problem with the 2nd one is the user could be a member of many groups, how does the system know which one to choose?
best bet in my opinion is to create a primary group field on the users record, populate that and then query for that from the user record.
Marc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2010 09:42 AM
All you need to do is provide your script with the sys_id of the group you wish to assign it to.
current.assignment_group.setDisplayValue("d625dccec0a8016700a222a0f7900d06");
if(current.isValidRecord()) {
// this is when close is called as an update, just update it
current.update();
} else {
// and insert the record
current.insert();
}