6

I want to assign Leads to a Queue in APEX. I know the queue's name e.g. 'New Leads Queue' When I query the DB for the QueueSobject I see it has no field with the queue's name. How can I find the Queue ID in order to assign the lead to it?

2 Answers 2

2

That code you're seeing with QueueSObject doesn't seem to be valid, I found this though:

You will find queue name in object Group:

Select g.Type, g.Name, g.Id, g.Email, g.DoesSendEmailToMembers, g.DoesIncludeBosses From Group g.

So maybe checkout the Group object?

2

It is available via the QueueId lookup field, the relationship name is Queue, so

Select Queue.Id from QueueSObject where Queue.Name = 'Test'

Assign the Lead Owner to Queue.Id as returned in the Query above.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .