A New Round Robin Lead Distribution Solution

A while back, I posted a solution to Round Robin Lead Distribution that passes leads from user to user, one after the other, as they are submitted via your web-to-lead system into Salesforce.com. It is a pretty good solution, but it has a few annoying limitations.

That technique's main shortcoming is that it doesn't easily adapt to changes in the workforce or schedule. The distribution is handled via lead assignment rules that are responding to results of a formula on the lead record - which means that as you want to change who is part of that lead distribution "circle", you have to edit the formula on the lead record and change the lead assignment rules to list who is at work and should be receiving the leads.

If you are a sales manger (who makes sure sales reps are getting and responding to leads) who isn't particularly tech savvy, you end up having to keep someone available who can understand how to make these modifications at the beginning of each work day to ensure the right people are getting the leads.

We've finally revisited the "Round Robin Lead Distribution" issue and decided to solve it with the help of triggers and visualforce pages.

The features we were wanted to have were:

1) The ability for users to "check themselves in" to the lead distribution to save the manager from having to do that.
2) Auto-logout users from the system after a given time so that they wouldn't continue to receive leads after they were no longer working.
3) Provide a visualforce page where a manager could see or change the list of users currently in the distribution cycle as easily as possible.
4) As each lead was submitted to salesforce.com, have the system look at all the users currently checked in to receive leads, and assign the new lead to the person who was least recently assigned a lead.
5) A method whereby the sales manager can distribute all leads that were submitted during a time when no users were selected to receive them.

To accomplish the above, we created the following components:

Custom Object: We started with a custom object called "Queue Members" which has a record for each user that is typically part of the lead distribution. This object references the user object and has a checkbox field for "Receive Leads" and a field that records the Date/Time of the last received lead. Also, a field is added to the Lead record with a lookup to the Queue Member record who received the lead - in doing this, a related list will show on each Queue Member record for all the leads assigned to that member via the lead distribution system.

Lead Queue: We created a new lead queue called "Round Robin Leads". It will temporarily hold leads received by the system until our trigger executes and determines who should own it. 

Lead Assignment Rules: We added a lead assignment rule that takes any leads that the sales manager wants to distribute via the Round Robin system and assigns them to the Round Robin Leads queue. This will be added to the Lead Assignment Rules in a sort order that allows the manager to grab any special cases and assign them to other reps as needed. Some leads probably won't be assigned via Round Robin, so we still want to take advantage of the lead assignment rules to pass leads to the Round Robin system as desired rather than bypassing the lead assignment rules system altogether.

Trigger: A trigger was written that executes at new lead creation. That trigger first checks to see if the new lead is owned by the Round Robin Leads queue. If it isn't, the trigger leaves it alone, if it is, the trigger then evaluates the Queue Member records and finds all of them that are ready to receive leads (as indicated by the Receive Leads checkbox being checked). It sorts those and identifies the user that has least recently been assigned a lead and then proceeds to change the ownership of the lead to that member.

Workflow Rule: A workflow rule is used to deselect the Receive Leads checkbox for anyone who has checked it, 4 hours after it was checked. The rule executes two processes, 1) it deselects the checkbox, and 2) it sends an email to the user so that they know they are no longer in the lineup.  If the user wants to rejoin the distribution, they simply edit their Queue Membership record and check the "Receive Leads" checkbox.

Visualforce Page: This last component is a page that shows on one page all the members of the round robin distribution. This is used by the sales manager to see who is in the lineup. Next to each person's name is a checkbox. It is checked if they are currently receiving leads and can be selected or deselected by the sales manager to update the list of those receiving leads. It may happen from time to time, especially after hours, that there are no users in the queue to receive leads, consequently, leads will be left in the Round Robin Leads Queue. Therefore, this visualforce page will also show a list of any unassigned leads just above a button called "Distribute Unassigned Leads". When pressed, that button will execute code to cycle through all the leads currently in the queue and give them to the members selected.

This is a fairly simple method that has fewer drawback than the formula based system I wrote about previously. Many salesforce customers will have the internal resources to build this system. If not, feel free to contact us - click here for our services webiste - and we can deploy the system we wrote into your salesforce.com instance.

2 comments:

Web Solo said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.