Assign to me button issue on incident form???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 05:01 AM
Hi All,
I have an UI action created on my incident form , here the issue is whenever the user clicks on assigned to me button on incident form it is
clearing the assignment group field value whatever is there and setting the assigned to value to me itself.
But, here i need that the assignment group field value should not be removed.
Below is the code for UI action:
var currentUserID = gs.getUserID();
var userDefaultGroup = '';
var userSysID = '';
var queryUserRecord = new GlideRecord('sys_user');
queryUserRecord.addQuery('sys_id',currentUserID);
queryUserRecord.query();
while (queryUserRecord.next()) {
userDefaultGroup = queryUserRecord.u_default_group;
userSysID = queryUserRecord.sys_id;
}
current.state = 2;
current.assignment_group = userDefaultGroup;
current.assigned_to = userSysID;
action.setRedirectURL(current);
current.update();
Here they are setting the assignment group value based on the users default group, which was set in their user account. But In our instance no user record is set with the default group. How can i fix this issue to set the assignment group and assigned to value if the user clicks on "Assigned to me" button to set the default values...
Please help me on this
Thanks
Madhuri.K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 06:35 AM
Hi Gaurav,
In my code, mentioned below I havent gliderecord, so we should not have security issue..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 06:25 AM
You can try this,
function onChange(control, oldValue, newValue, isLoading) {
var userID = g_user.userID;
g_form.setValue('opened_by',userID);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2017 05:12 AM
Hi,
Use:
var currentUserID = gs.getUserID();
var userDefaultGroup = '';
var userSysID = '';
var queryUserRecord = new GlideRecord('sys_user');
queryUserRecord.addQuery('sys_id',currentUserID);
queryUserRecord.query();
while (queryUserRecord.next()) {
userDefaultGroup = queryUserRecord.u_default_group;
userSysID = queryUserRecord.sys_id;
}
current.state = 2;
//current.assignment_group = userDefaultGroup;
current.assigned_to = userSysID;
action.setRedirectURL(current);
current.update();
thats it