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
GRStevenBrookesGRStevenBrookes 

Automatic Account Allocation

Hi All,

 

We have a a number of 'Account Owners' that need to have an equal number of accounts allocated to them, is there a way (either through apex or another method) to lookup how many accounts each owner has and then allocated any new accounts to the owner with the least number of accounts or in the event that 2 or more owners have the same number, to the owner who hasnt had an account allocated to them for the longest amount of time.

 

I hope this makes sense!

 

Thanks in advance for any assistance

 

Steve

Abhay AroraAbhay Arora

Hi Steve,

 

You need to have a apex code for this may be a batch apex which just calculates the count and change the owners accordinly

 

Let me know what you think of above

PaqsPaqs

Hi Steven,

 

I'd recommend a trigger on new account creation that will lookup current counts for account owners and sort this count by ascending to find the one with the least accounts. Once you have that, you can set the owner to this one.

 

Hope this helps,

 

Cheers,

GRStevenBrookesGRStevenBrookes
Hi sorry for delayed reply. Can you help with this trigger at all, my skills do not yet stretch that far.

Steve