+ Start a Discussion
Deepu sfdcDeepu sfdc 

Apex trigger to assign all incoming leads in a Round-Robin fashion

Criteria :
  1. If the lead RecordType = ‘US Lead’, then assign the lead to users with country = ‘USA’
  2. If the lead RecordType = ‘International’, then assign the lead to users with Country != ‘USA’
The assignment has to happen in a round-robin fashion.
 
For eg., if there are only 3 users(User1,User2,User3) with country = ‘USA’ in the system then the first lead with RecordType = ‘US Lead’ will be assigned to User1, Second lead with RecordType = ‘US Lead’ will be assigned to User2 and so on.
The same logic applies to international leads.
 
Workload balance in lead assignment : It would be good if the workload of the user is considered in lead assignment. For eg., User2 is the next in line to get a lead assigned through round-robin fashion and he has 10 open leads and User3 only has 2 open leads assigned. Even though User2 is the next in line, in order to balance the workload of users, the lead can be assigned to user3.
 
 
Deepu sfdcDeepu sfdc
Thanks Amit..
Can you send me the code for that criteria ..
Deepu sfdcDeepu sfdc
Hi Amit,
I am not able to use that link. It need credentials.
 
Amit Chaudhary 8Amit Chaudhary 8
Please check below post
1) https://help.salesforce.com/apex/HTViewSolution?id=000004000

All Step are mention on same.