Set the assignment group base on UI action

Admin Pro
Tera Contributor

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.

6 REPLIES 6

I guess if you didn't want to have to lookup the sys id of the group manually you could just do a glide record get.



var gr = new GlideRecord('sys_user_group');
gr.get('name','Help Desk');
current.assignment_group.setValue(gr.sys_id);
if(current.isValidRecord()) {
// this is when close is called as an update, just update it
current.update();
} else {
// and insert the record
current.insert();
}


narinder_guru
Kilo Contributor

Thanks alot, I will try this out...... much appreciated