function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sarma DuvvuriSarma Duvvuri 

List of queues assigned to the user

Hi,

Can anyone tell me,  Can we display the list of queues and public groups assigned to the particular user in report or dashboard?

Thanks in Advance.
Sarma
Raj VakatiRaj Vakati
I dtn think so you can able to report in the Queue member ..  but you can use the SOQL 

https://success.salesforce.com/ideaview?id=08730000000BqYaAAK

https://douglascayers.com/2014/07/06/salesforce-how-to-export-queue-members-to-excel/
 
Sarma DuvvuriSarma Duvvuri
Thank you Raj for your quick response.

But is there any way to display the list of queus in dashboard like using any code or lightnning.

Thanks,
Sarma
Sarma DuvvuriSarma Duvvuri
Hi All,

I creted one custom object (Queue__c) and i want to insert all the queue records which are assigned to the logged in user. I tried with below  trigger. but its not working. cn you help me on this. 

trigger AssignQueue on Queue__c (after insert) {
    
    List<Queue__c> qu = new List<Queue__c>();
    Id userId = UserInfo.getUserId();
    
    Group g = [Select id, Name from Group where Type='Queue'];
    GroupMember gr = new GroupMember();
    gr.UserOrGroupId = userId;
    gr.GroupId = g.Id;    
    insert gr;
    for(Queue__c q : Trigger.new){
        q.Id = g.Id;           
            qu.add(q);
    }
    insert qu;
}

Thanks,
Sarma
Raj VakatiRaj Vakati
Use this code and add other fields 
 
trigger AssignQueue on Queue__c (after insert) {
    
    List<Queue__c> qu = new List<Queue__c>();
    Id userId = UserInfo.getUserId();
    
    List<Group> g = [Select id, Name from Group where Type='Queue' AND  UserOrGroupId =:userId];
    for(Group gp: g){
  Queue__c q = new Queue__c() ; 
  q.Name = gp.Name ; 
  //add other fields ; 
  
qu.add(q) ;
  }
    insert qu;
}

 
Sarma DuvvuriSarma Duvvuri
Thank you for your quick reply raj.

Select id, Name from Group where Type='Queue' AND  UserOrGroupId =:userId

in this scenario Group does not have UserOrGroupId  field it is in group memeber. i am not able to insert

Thanks,
Sarma
Sarma DuvvuriSarma Duvvuri
Hi Raj,

i tried the below code. but no luck.

trigger AssignQueue on Queue__c (after insert) {
    
    List<Queue__c> qu = new List<Queue__c>();
    Id userId = UserInfo.getUserId();
    
    List<Group> g = [Select id, Name,(select Id, UserorGroupId FROM GroupMembers where UserorGroupId =:userId) from Group where Type='Queue'];
    
    for(Group gp: g){
        Queue__c q = new Queue__c() ; 
        q.Queue_Name__c = gp.Name; 
        qu.add(q) ;
    }    
    insert qu;
}