Round Robin Assignment Rule for certain Lead Sources - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Doug HeindelDoug Heindel 

Round Robin Assignment Rule for certain Lead Sources

HI All,

I am implimenting a round robin assignment rule but only want it to apply for certain inbound lead sources (i.e. Adwords, LinkedIn Ads, Facebook Ads, etc.)

I have this formula so far:  MOD(VALUE(Lead_Number__c) ,2) +1

But I am having trouple figuring out a formula for the lead source side of this.

Has anyone done this?

Any help is appreciated!
Aaron DeRanAaron DeRan
Follow all of the steps provided in this blog post:

http://success.salesforce.com/ideaview?id=087300000006tYIAAY

EXCEPT... make the formula in step 2 the following:

IF(ISPICKVAL(LeadSource, "Adwords"), 1 +MOD(VALUE({!Lead_Number__c}), #),
     IF(ISPICKVAL(LeadSource, "LinkedIn Ads"), 1 +MOD(VALUE({!Lead_Number__c}), #),
          IF(ISPICKVAL(LeadSource, "Facebook Ads"),
1 +MOD(VALUE({!Lead_Number__c}), #),
null)))


<continue the nested IF() statements for each included Lead Source>

This way, only the Lead Sources you include will get round robined.



James JetchickJames Jetchick
I'm not sure if the auto number strategy is going to work for you. Say you have 3 people handling leads.

 Leads come in as:
Auto-number: 0000 Lead Source: Adwords - Goes to Rep 1
Auto-number: 0001 Lead Source: Other - Would go to rep 2 but does not because of lead source
Auto-number: 0002 Lead Source: Other - Would go to rep 3 but does not because of lead source
Auto-number: 0003 Lead Source: Adwords - Goes to Rep 1

Rep 1 has 2 leads, the other two have none. The assignment rule is ultimately based on the auto number. Not sure if thats your desired outcome.
Aaron DeRanAaron DeRan
Jimmy - thats why I tweaked it with the nested IF() statements to only include the specific Lead Sources in the auto-number strategy. Do you see any flaws in it?
James JetchickJames Jetchick
My concern is that Auto-number increases on every lead, not just the ones that match the desired lead sources.

The assignment rule would still operate but there's no guarantee that the reps buckets for leads from these sources will be the same size.

If you have 3 reps and exactly every 3rd lead comes from Adwords, LinkedIn Ads, Facebook Ads, etc and the rest come from a different lead source. The same rep would get all the Adwords, LinkedIn Ads, Facebook leads.

Not necessarily incorrect but maybe not the desired intent.


Aaron DeRanAaron DeRan
Great point. Are you thinking only a trigger would  be able to achieve this? With a trigger you could replicate the effects of an Auto Number field under certain constraints, right? Just create a Read Only Number field and a trigger that updates it +1 only if the Lead Source is one of the desired ones. Whats your thoughts on this?
James JetchickJames Jetchick
It is doable with the trigger, the tricky part is finding what your next auto number is. Couple options would be to locate the last Lead you create that was generated a number from the trigger.

You could create a custom object with 1 instance of the object, store the number on there an increment it when the trigger finds the correct lead sources.(Not my favorite way to do it)

I've always been curious if you can store/update a value like this in Custom Settings or somewhere else like that. I have never had a need for it so I have never looked into it.
Doug HeindelDoug Heindel
phiberoptik,
The fomula you gave is spot on. Thanks for that. It all makes a lot of sense now.

Jimmy Jay,
Your concern is correct. After implimenting and testing, Reps were skipped if a lead was entered with a Lead Source not in the Round Robin formula.

I am 1/2 way there, thank you both very much!

If you have any more suggestions, they are most appreciated.
Aaron DeRanAaron DeRan
Honestly I have gone over this in my head a few times and a trigger/number field to create a conditional autonumber field is the only solution I believe will work.
Doug HeindelDoug Heindel
You wouldn't know any good resources or walk-thrus for this would you? I've never set up a trigger before.

Thanks!
Aaron DeRanAaron DeRan
Click Developer Force in the upper right corner of this website and then click Boards across the top. Post your questions in the Apex Code Development board.
Doug HeindelDoug Heindel
Thanks for all your help!
Matt BertuzziMatt Bertuzzi
This just saved me big time. I needed to round robin ONLY when a checkbox was checked. Seems to be working like magic.
Aaron DeRanAaron DeRan
Matt,

What exactly did you end up using that worked so well for you?
Matt BertuzziMatt Bertuzzi
I used your exact forula (replacing checkbox) with the understanding that we aren't going to have 100% even splits.

I ran an analysis of MTD, QTD & YTD - while the distrubution was +/- 10%, there were no consistent winners or losers.

NOTA BENE - this approach works for us as we are willing to tolerate short-term inequity. (Also, I'm a clicks-not-code admin)

We'll need to evaluate over time to see if in the long-run, certain reps are winning/losing.
Aaron DeRanAaron DeRan
Great. Glad it worked and I hope it does workout long term for you. I am always trying to avoid code development but there comes a time when the ROI is worth the investment in code dev.

Good Luck!
Lucas CushanickLucas Cushanick
I've written a couple Apex variations on round robin assigning for my company the latest of which uses a very simple trigger to write to a custom object that tracks the number assigned to users. We couldn't tolerate any margin of error in assignment.

While I can't share the code per se (company IP) I'm glad to advise on the structure.
Yaniv MasjediYaniv Masjedi
Has anyone found a solution to this problem? I do not have salesforce enterprise so I have no way to write Apex code or use a work flow rule. There has to be a way to do this that doesn't require an upgrade. I do have marketo and I have been trying to figure out ways to use that with salesforce to make the round robbin work based on lead source and not auto number every single lead. Any help would be great. 

Thanks,
Eric
sandeep kumarsandeep kumar
Hello Luke,

I am facing the same problem with round robin . when i use an autonumber approch it skips one user. can you explain me how you did using Apex. what i understood is you have a custom object which will store the users number . so i need to have a field in users object and assing a number to user and then when a lead is created i store the user number to who lead got assigned ? 
Neil CrawfordNeil Crawford
Just a note (and shameless plug) for anyone looking for a robust Round Robin solution. We have an AppExchange app called Distribution Engine which can help with all these requirements. It is a paid app but very rich in features and highly reviewed.

If anyone is interested please take a look at our AppExchange listing here (https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009x4YAEAY)

 Thanks!

Neil