+ Start a Discussion

Account Ownership

Hi All,


Ive been racking my brains for a solution to my problem, but everyone I come up with is overly complex! So I thought id put it out there!


I need to allocate the owner of an Account based on round robin assignment taking into account the number of accounts each 'Owner' has for example


Owner 1 has 10 Accounts

Owner 2 has 11 Accounts

Owner 3 has 9 Accounts


When a new account is created Owner 3 would be the owner has they ave the least, then 1, then 2.


Any ideas?



How you are creating a solution for this ?


One way I would think of is :


Query the User object to see the number of accounts associated with each one. Order by decending/ascending and pick the one least one for assignment. 


You can have the call in before insert trigger ....


Please let me know if I did not properly undesrtand the requirement ...




Your suggestion sounds perfect - the only problem is this is a little advanced for my basic apex skills - are you able to help with the trigger? I would be eternally greatful!