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
Prashant Pandey.Prashant Pandey. 

Write a Trigger to assign leads in a Round Robin manner. Create a queue and add 3 to 4 users to it. Whenever a lead is assigned to that queue, reassign the lead to one of the users in the queue in a Round Robin manner.

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi prasant,

You can use assignment rules for the above requirement.
Assignment rules automate your organization’s lead generation and support processes. Use lead assignment rules to specify how leads are assigned to users or queues. Use case assignment rules to determine how cases are assigned to users or put into queues.

Please refer below links which might help you in this
https://help.salesforce.com/articleView?id=customize_leadrules.htm&type=5 (https://help.salesforce.com/articleView?id=customize_leadrules.htm&type=5)
https://www.shellblack.com/administration/create-a-round-robin-lead-or-case-assignment-rule/
https://focusonforce.com/configuration/salesforce-round-robin-lead-and-case-assignment/​​​​​​​

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards
MOURITECHMOURITECH
Hi Prasant,

  When ever Lead is created with Particualr condition then assigned to Queue. if not met the condition then assign to particular user in queue.
please see the below code
Apexclass:
==========
public class Lead_Assign_toQueue {
    public static void get(list<lead> leads){
        group g=[select id,name from group where name='OnlyTwo'];
        user u=[select id,name from user where alias='QueueUser'];
        for(lead l:leads){
            if(l.LeadSource=='web'){
                l.OwnerId=g.id; 
            }else{
                l.OwnerId=u.id;        
            }
        }   
    }
}

Trigger:
======
trigger Lead_Assign_toQueue on Lead (before insert) {
    if(trigger.isbefore && trigger.isinsert){
        assignleaddd.m(trigger.new);
        
    }

}


Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks,
MOURITECH
Naga  AlapatiNaga Alapati
Hi Prasant,

You can find the trigger for lead assignment in round robin manner in this post

https://medium.com/@Naga801/salesforce-trigger-for-lead-round-robin-assignment-bcda7cc4193b