You need to sign in to do that
Don't have an account?
Josip Juric87
Manage Queue ListView Visibility through Apex
Hi! There is the possibility to create Queues from Apex with this code:
Also, we can add members to the Queue like this:
But, a Queue also get a ListView created, where the SObjects (in this case Leads) are filtered by the Queue ownership. How do we also enable specific users to get visibility to that Queue ListView? I know it's possible manually through the UI, by editing the ListView and adding the users under "Step 4. Restrict Visibility", but is it possible in Apex?
Group g = new Group(Name = 'Lead Queue 1', Type = 'Queue'); insert g; QueueSobject qo = new QueueSObject(QueueId=g.Id, SObjectType = 'Lead'); insert qo;
Also, we can add members to the Queue like this:
GroupMember gm = new GroupMember(GroupId = g.Id, UserOrGroupId = UserInfo.getUserId()); insert gm;
But, a Queue also get a ListView created, where the SObjects (in this case Leads) are filtered by the Queue ownership. How do we also enable specific users to get visibility to that Queue ListView? I know it's possible manually through the UI, by editing the ListView and adding the users under "Step 4. Restrict Visibility", but is it possible in Apex?
In the list view edit. Step 4.
Select : Visible to certain groups of users
In that select a public group without any members.
then using this code you can add members to the public group dynamically.
Let me know if it helped.