I want to remove the the user from assigned to field but the user must present in the group??

gokulraj
Giga Expert

My requirement is to hide the user1 from assigned to when selecting the assignment group while creating an incident ,but the user must be a member in   the group.

1 ACCEPTED SOLUTION

This needs to be added as an advnaced reference qualifier to the assigned_to field, not assignment_group.


View solution in original post

26 REPLIES 26

This needs to be added as an advnaced reference qualifier to the assigned_to field, not assignment_group.


Hey David Dubuis



  You are right I have changed that to assigned_to field .It is working fine for the network group but when I choose other group I was not able see the assigned to members.Please refer the below images.



incident ass to.pngempty assignment.PNG




when I choose the assignment group as software no user is available.


add in an else statement:



var excludeUser = Class.create();  


excludeUser.prototype = {  


initialize: function() {  


},  


 


excludeUser:function() {  


var users = "sys_id=1234";  


 


if(current.assignment_group.getDisplayValue() == 'Network'){  


 


var gr = new GlideRecord('sys_user_grmember');  


gr.addEncodedQuery('group=' + current.assignment_group + '^user!=9ee1b13dc6112271007f9d0efdb69cd0');  


gr.query();  


 


while(gr.next()) {  


var user = gr.getValue('user');  


users += ("^ORsys_id=" + user);  


}  


}  


else{


var gr = new GlideRecord('sys_user_grmember');


gr.addEncodedQuery('group=' + current.assignment_group);


gr.query();  


 


while(gr.next()) {  


var user = gr.getValue('user');  


users += ("^ORsys_id=" + user);  


}  


}  


return users;  


},  


type: 'excludeUser'  


};  


Hey David,



      Thanks for the guidance.It works exactly as per my requirement.you rocked...!!!!!!!!!!!!!!!!!!!!!



Regards,


Gokulraj S.


Hey David Dubuis



                                      What is the use of these two lines.



var users = "sys_id=1234";


users += ("^ORsys_id=" + user);