You need to sign in to do that
Don't have an account?
Group, Group member and User
Hello Guys,
Hope you all are safe!!
I want to show users name and when the user is added to particular group on lighting page.
First part I am able to display users name and to display users added date I need your help
This code is showing all the users added in public group/Queue so along with this name of users I would like to show when the user is added to grp/queue
public with sharing class HRM_GetQueueMembers_ctlr {
@AuraEnabled
public static List<Group> getQueue(){ //this function fetches all the queues
List<Group> QueueList = [Select Name,CreatedDate from Group where type='Queue' and DeveloperName like 'HRM%' ORDER BY Name ASC];
system.debug('---QueueList'+QueueList);
return QueueList;
}
@AuraEnabled
public static List<User> getQueueMembers(Id QueueId){ //this function fetches queue members
List<GroupMember> publicGroupList = [Select UserOrGroupId from GroupMember where GroupId=:QueueId];
system.debug('---publicGroupList'+publicGroupList);
List<Id> listGroupId = new List<Id>();
List<User> MemberList = new List<User>();
List<Id> listOfUsersId=new List<id>();
try{
for(GroupMember gm:publicGroupList){
string mId = gm.UserOrGroupId;
if(mId.left(3)=='005'){ //If first 3 char of UserOrGroupId are '005' then it is a user
listOfUsersId.add(mId);
}else if(mId.left(3)=='00G'){ //If first 3 char of UserOrGroupId are '00G' then it is a group
listGroupId.add(mId);
}
}
//while(listGroupId.size()>0)
//This loop will run untill there are public groups inside public groups(removed while loop due to sonar cube issue)
List<GroupMember> MemberIds = [Select UserOrGroupId,SystemModstamp from GroupMember where GroupId=:listGroupId];
listGroupId.clear();
for(GroupMember m : MemberIds){
string mId = m.UserOrGroupId;
if(mId.left(3)=='005'){ //If first 3 char of UserOrGroupId are '005' then it is a user
listOfUsersId.add(mId);
//listofUsersId.add(D);
}else if(mId.left(3)=='00G'){ //If first 3 char of UserOrGroupId are '00G' then it is a group
listGroupId.add(mId);
}
}
if(listOfUsersId.size()!=0){
List<User> u = [Select Name, profile.Name, UserRole.Name from User where Id in:listOfUsersId ];
if(u.size()>0){
MemberList.addAll(u);
}
}
}
catch(Exception e){
e.getStackTraceString();
}
return MemberList;
}
}
Any thoughts or help will be much appriciated!!
https://lifestatus.in/love-status/
https://lifestatus.in/life-status-in-hindi/
https://lifestatus.in/love-status-in-hindi/
https://lifestatus.in/mahakal-status-in-hindi/
https://lifestatus.in/love-status-in-hindi-shayari-for/
https://lifestatus.in/attitude-status-in-hindi/
https://lifestatus.in/royal-attitude-status-in-hindi/
https://lifestatus.in/whatsapp-status-in-hindi-attitude-status/
https://lifestatus.in/attitude-status-in-hindi-for-whatsapp/
https://lifestatus.in/dosti-status-in-hindi/
https://lifestatus.in/facebook-status-in-hindi-and-attitude-too/
https://lifestatus.in/love-status-in-hindi-for-whatsapp/
https://lifestatus.in/attitude-status/
https://lifestatus.in/attitude-status-for-whatsapp/
https://lifestatus.in/sad-status-in-hindi-for-whatsapp/ (https://lifestatus.in/sad-status-in-hindi-for-whatsapp/ )
https://lifestatus.in/life-changing-status-in-hindi-whatsapp/
https://lifestatus.in/motivational-status-in-hindi/
https://lifestatus.in/inspirational-status-for-whatsapp
https://lifestatus.in/miss-you-status-in-hindi