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
smitha george 5smitha george 5 

Writing a Trigger..

Hi,
Can you write an apex trigger to assign all incoming leads in a Round-Robin fashion to users based on the following 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’
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.
Thanks in Advance..

 
NagendraNagendra (Salesforce Developers) 
Hi Smitha,

Why don't you try to use Omni-Channel? Omni-Channel is to assign Leads by workload and you save your time developing the trigger.

How Does Omni-Channel Routing Work:  Hope the information helps.

Best Regards,
Nagendra.
smitha george 5smitha george 5
Hi Nagendra,

Please i want to write trigger only..