Assign to me button issue on incident form???

madhu517
Kilo Contributor

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

17 REPLIES 17

gauravchoudhury
Tera Guru

Hi Kalluri,



Please check if the following thread helps you out with your query.


Jaspal Singh
Mega Patron
Mega Patron

Hi Kalluri,



Could you try & use below code:



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 = currentUserID;


action.setRedirectURL(current);


current.update();


Hi Jaspel singh,


I have commented the code as shown: //current.assignment_group = userDefaultGroup;


But here the assigned to is setting the user who clicks on that button,however he is not part of that assignment group.



suggest me on this.



Thanks


Madhuri.K


Question: that is what Assign to me literally means, right?