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
Domnic JohnsonDomnic Johnson 

How can I not let users accept or own new leads when old leads are in queue?

I want to restrict sales users from accepting new leads under they ownership when there are old leads in a queue

How can this be done? Please, help!
Best Answer chosen by Domnic Johnson
Domnic JohnsonDomnic Johnson
Hi Shawn.

Thanks for responding back

The requirement got little more complexed so we just had to use a trigger.

We needed the uses to have only one lead records at a time which has a lead status of uncontacted
We needed the sales rep to accept leads which were the oldest
Limit the number of leads accepted only 1 record at a time 
Finally, we needed to exclude 3 users from the above restrictions  

Regards, 
Domnic

All Answers

Shawn Reichner 29Shawn Reichner 29
Domnic,

I woudl create a Validation Rule that states one of the two followign statements depending on how you want this to run in your org. 

1. Lead.Owner is Changed AND User.Profile EQUALS "Sales" AND Lead.Owner PREVIOUSVALUE is "Queue Name"
or
2. Lead.Owner is Changed AND User NOT EQUAL to "Fill in User Info here"

Number one will make sure that no user in the Sales profile can update the Owner field on a lead unless it was owned by a Queue
or
Number two will make sure that is a single person or persons are supposed to assign leads to sales users you can list them and if anyone else in the org attempts to reassign a lead and it is not the person or persons identified then the error would throw and the lead would not be able ot be re-assigned.  

Hope that all makes sense,

Shawn
Domnic JohnsonDomnic Johnson
Hi Shawn.

Thanks for responding back

The requirement got little more complexed so we just had to use a trigger.

We needed the uses to have only one lead records at a time which has a lead status of uncontacted
We needed the sales rep to accept leads which were the oldest
Limit the number of leads accepted only 1 record at a time 
Finally, we needed to exclude 3 users from the above restrictions  

Regards, 
Domnic
This was selected as the best answer