• Hazarath M
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi, 

 How to remove null values from list in apex

Thanks
Sudhir
Hi! There is the possibility to create Queues from Apex with this code:
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?