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
Jinfonet MarketingJinfonet Marketing 

Automate account owner transfer

Hi all!

I need some help to automate account owner transfer from "salesman" user to "coldcaller" user for leads that stay in 'Attempted Contact' status for over 20 days. "Coldcaller" user must be notified by email of account owner transfer.

I talked to salesforce support but they said this can only be done by Apex Trigger. Is there anyone who already have something like this in place?

Thanks!!!
Sarah
Best Answer chosen by Jinfonet Marketing
Always ThinkinAlways Thinkin
The way we handled this was to create a custom object to hold a list of the Coldcallers to whom Account should be reassigned. You could name the object Coldcaller but for future changes, you might choose something more generic like Assignees. This object should have fields like the following:
Name (record name, probably copied from User)
User (a lookup to User records)
Record Count (a number, preferably an integer set by using 1,0)

Also useful:
Is Active (a formula to make sure the User is actually Active)
Type (if you want to subdivided potential assignees with logic)
Multiplier (number, probably 1,2, if you want some assignees to receive more Accounts to call than others)
Score (product of Record Count * Multiplier to allow sorting by has the most/least)

To satisfy the 20 day threshold, you could use a Time-based Workflow Field Update that populates an empty text or date field (Reassign__c) 20 days after the last update to Attempted Contact.

Your Apex Trigger would watch for changes to Reassign__c done by the Workflow Update. When this happens Apex queries the Coldcaller records for the User with the lowest Record Count (or Score) and retrieves the User ID related to that Coldcaller record. This User ID is then used as the new Owner on the Account. Finally, Apex also updates the Coldcaller record's Record Count by 1 to indicate that the User has received another Account, and will go to the end of the line of Coldcallers.

All Answers

Abhishek BansalAbhishek Bansal
Hi,
 
Your requirement can be achieved with the help of a batch class and than you can schedule your batch class to run  on every 20th day in order to process recent Accounts.
You can also send email from batch class.

Kindly let me know if you need more help on this.

Regards,
Abhishek.
Always ThinkinAlways Thinkin
You might also be able to avoid the need for a batch job if you used a Time-Based Workflow to trigger the Apex necessary to change the Owner. I've built a couple Owner re-assignment apps.

I would suggest that the re-assignment logic be flexible enough to allow for roundrobin re-assignment to a list of potential owners. Your stakeholders will likely expect that behavior rather than just assigning to the same person every time. This would require a custom object that tracks potential Users and is used to evaluate who should get the next Lead re-assigned to them. Alternately, you could assign the Lead to a coldcaller Queue from which those users can choose their own.

Another idea to drive roundrobin is to use Lead Assignment Rules and a counter field (this is an old SFDC trick) but this would only be manual not automatic although it would make it easier to maintain a list of potential coldcaller Owners, and the re-assignment could be triggered with Apex that utilizes Database.DmlOptions.Assignmentruleheader.

Before we get further into design, which of these methods sounds like it would suit your needs?
Jinfonet MarketingJinfonet Marketing
Sounds like the one you mentioned first (not the manual one) would work better. Do you know how I can get started on this?
Always ThinkinAlways Thinkin
The way we handled this was to create a custom object to hold a list of the Coldcallers to whom Account should be reassigned. You could name the object Coldcaller but for future changes, you might choose something more generic like Assignees. This object should have fields like the following:
Name (record name, probably copied from User)
User (a lookup to User records)
Record Count (a number, preferably an integer set by using 1,0)

Also useful:
Is Active (a formula to make sure the User is actually Active)
Type (if you want to subdivided potential assignees with logic)
Multiplier (number, probably 1,2, if you want some assignees to receive more Accounts to call than others)
Score (product of Record Count * Multiplier to allow sorting by has the most/least)

To satisfy the 20 day threshold, you could use a Time-based Workflow Field Update that populates an empty text or date field (Reassign__c) 20 days after the last update to Attempted Contact.

Your Apex Trigger would watch for changes to Reassign__c done by the Workflow Update. When this happens Apex queries the Coldcaller records for the User with the lowest Record Count (or Score) and retrieves the User ID related to that Coldcaller record. This User ID is then used as the new Owner on the Account. Finally, Apex also updates the Coldcaller record's Record Count by 1 to indicate that the User has received another Account, and will go to the end of the line of Coldcallers.
This was selected as the best answer
Jinfonet MarketingJinfonet Marketing
Cool, I will have to look at this in detail...but, would you be able to code this for us for a fee? 
Always ThinkinAlways Thinkin
Hi, I can't help write it, I'm not a consultant but there are plenty of consultancies around the world that could help you. If you haven't hired one before, this blog article will give you some good tips on how to find one: http://www.salesforceben.com/26-questions-choosing-salesforce-consultant/

And if your question is sufficiently answered, please mark a Best Answer so we keep the forums easy to search for those still in need of further help.