Filter users in the uidesigner
Hello everybody.
I receive a list of all my users from an external API: ../API/identity/user?p=0&c=199
.
And I populate all those users in a select.
Is there any chance to filter these users by group, role, or something?"
I have tried looking for :
-
/API/identity/membership
/user_id = {{userId}}
and iterating, but when I iterate the users, it doesnt work.
thanks
Hi Use this API to get User groups . Pass the current logged in User using the session API. /bonita/API/identity/membership?p=0&c=10&f=user_id%3d{{currentLoggedInUser.user_id}}&d=role_id&d=group_id then use this Javascript to sort the Groups and get the required group name
var arr = $data.getUserGroups;
var drr = [];
var crr = [];
var value = '';
var myLength = arr.length;
var i=0;
for(i;i
{
var val = arr[i].group_id;
drr.push(val);
}
var j =0;
for(j;j
{
var val1 = drr[j].displayName;
crr.push(val1);
}
//var k=0;for(k;k
{
//var val2 = crr[k];
if(crr.includes('Billing Ops'))
{
value = 'Billing Ops';
}
else if(crr.includes('Telesales Team'))
{
value = 'Telesales Team' ;
}
else if(crr.includes('Collection Team'))
{
value = 'Collection Team';
}
else if(crr.includes('Retention Team'))
{
value = 'Retention Team';
}
else
{
value = 'Invalid Group';
}
}
return value;
Comments
Thank you for the answer. but your solution is just for one user. If I iterate a list of users I receive a list with the info of the last user repeated.