The CreatorCon Call for Content is officially open! Get started here.

select a group in assignment group field so in assigned to only particular grpmemebr see not all us

ishwarsingh
Tera Contributor

 

var grUser = new GlideRecord("sys_user_grmember");
grUser .addQuery("group", current.u_assignment_group);
grUser .addQuery('user', '!=', current.u_assigned_to);
grUser .query();
var querStr = '';
while (gr.next()) {
if (querStr == '') {
querStr = 'sys_idIN' + grUser .getValue('user');
} else {
querStr += ',' + grUser .getValue('user');
}
}
return querStr;
},

 

 

1 ACCEPTED SOLUTION

Rafael Batistot
Kilo Patron

Hi @ishwarsingh 

in your code you've started with  "var grUser = new GlideRecord" and in your "while" loop you've inserted "while (gr.next()) {". This is not correct

May you try 

var grUser = new GlideRecord("sys_user_grmember");
grUser.addQuery("group", current.u_assignment_group);
grUser.addQuery("user", "!=", current.u_assigned_to);
grUser.query();

var querStr = '';
while (grUser.next()) {
    if (querStr == '') {
        querStr = 'sys_idIN' + grUser.getValue('user');
    } else {
        querStr += ',' + grUser.getValue('user');
    }
}

return querStr;




If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.

View solution in original post

6 REPLIES 6

Brian Lancaster
Tera Sage

This should be handled already out of the box. If you right click on the assigned to field then on the dependent field tab assignment_group should be listed already. This will limit the assigned to only show the group members. At least that is what I think you are asking. If I'm incorrect please see give more details.

BrianLancaster_0-1756230223947.png

 

Rafael Batistot
Kilo Patron

Hi @ishwarsingh 

in your code you've started with  "var grUser = new GlideRecord" and in your "while" loop you've inserted "while (gr.next()) {". This is not correct

May you try 

var grUser = new GlideRecord("sys_user_grmember");
grUser.addQuery("group", current.u_assignment_group);
grUser.addQuery("user", "!=", current.u_assigned_to);
grUser.query();

var querStr = '';
while (grUser.next()) {
    if (querStr == '') {
        querStr = 'sys_idIN' + grUser.getValue('user');
    } else {
        querStr += ',' + grUser.getValue('user');
    }
}

return querStr;




If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.

these is right solution you have given to me

 

and when we select assigned to user so in assignment group only that group we have to see in which a user is member of that group not all group