Search This Blog

Thursday, July 28, 2011

Custom Round Robin Lead Assignment

Have you ever needed to implement round robin lead assignment in Salesforce.com. If you have, then you are familiar with the suggested approach of using assignment rule entries and a couple of custom fields. Although it works, it becomes a pain to manage once the number of members in the round robin start to climb. Other approaches would use custom Apex triggers. I'm not developer, but I'm brave enough to mess with existing apex and this is where a fantastic little free app from the AppExchange comes in.

Currently my favorite approach leverages the Round Robin Record Assignment  app from Force Labs available on the AppExchange. The app is configured to manage the assignment of cases, but with a little tweaking of the triggers and the class, you can get it to manage leads as well.We added a couple of custom fields and work flows and VIOLA!!! You have your custom Round Robin Lead Assignment application that you can also manage from from your iPhone or Blackberry (and you know Android is coming next month).

The app, as we have customized it, allows us to add members (users) to the assignment group with a couple of clicks and removed them by simply setting their Active status in the Assignment Group to "false". You can also schedule the removal and re-insertion of members from and into the round robin cycle. This is useful when a rep is going on vacation. All you have to do is enter the date that he/she will be leaving and the date of their return. The work flows will take care of changing their active status in the assignment group to false and back to true on their scheduled return date.

Before if you wanted to individually assign leads to 20 reps using round robin, segmenting them as Hot and Warm, you would have to create 1 assignment rule entry per user per queue (Hot and Warm queue). That's 40. With this app, you can now do this with 2 rule entries and let the Assignment Group membership handle the actual assignment.Thank you Force Labs.

Here's a link to the setup and configuration of the app.
Round Robin Record Assignment - Setup and Configuration.

Below I have included a screenshot of the Assignment Group screen. You can see the number of users (20) in the group. and you can see what Queues are associated with the group. In this case there is only one. By looking at the Assignment Group Members related list, you can see the members and their statuses, the last  assignment made in the group to the member, as well as any scheduled dales for exiting and re-entering the assignment group.







64 comments:

  1. How were you able to select "Type: Leads" ... ours defaults to "Type: Cases" with no other option.

    ReplyDelete
  2. I modified the Apex Triggers and Class to accommodate Leads in addition to Cases.

    ReplyDelete
  3. Thank you for the quick response Javier. I noticed you posted some review comments on the app on how you set up your custom workflow of dates to set active off,and etc...

    Is there are pre-made app that has all the customization you made...? I mean, this is pretty complex unless you know programming.

    ReplyDelete
  4. Can we contract your services to setup our salesforce? we are looking to do exactly what you have done, but don't have time to figure this out on our own.

    ReplyDelete
  5. Email me your contact info and I will put you in touch with someone that can implement this for you. Javweb@gmail.com

    ReplyDelete
  6. This is awesome. I just tested with cases and it will work perfectly for leads with the proper tweaks.

    I may be interested in some help with the code changes to make it work, though.

    Thanks for this Javier.

    ReplyDelete
  7. You're welcome Joe. Let me know if you need assistance.

    ReplyDelete
  8. I was able to hack the code of the package and make it work for leads (so cool, especially for a non-developer like me).

    However I was trying to create it as a Package (for better administration / best practices), but it fails test coverage when uploading.

    System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Lead, original object: QueueSobject: []

    Any advice on changes to the Class to get it to pass the test for creating the package?

    ReplyDelete
  9. I have added the code for making it work with Leads here: https://gist.github.com/1562280.

    ReplyDelete
  10. As for allowing the picklist to have Leads as well as Cases, you can do that by editing the field on the custom object to add a Leads dropdown as well.

    ReplyDelete
  11. Awesome Evan. Thank you so much. Do you mind if I post your link? There are a lot of people out there that will be very happy you did this. Thanks again.

    ReplyDelete
  12. Javier,

    Can you by any chance make your code available in which you modified this app to deal with leads? I have 5 territory queues of leads and need to round-robin assign those leads to sales reps that belong to those queues.

    Thanks for any help!

    ReplyDelete
  13. Tanya,

    Evan made this code available on GitHub. He modified it to work with both Leads and Cases.
    Make sure to include the change suggested by Andy. You'll see it at the bottom of the page.

    https://gist.github.com/1562280

    ReplyDelete
  14. Hi Javier,

    This is exactly what I am looking for. Unfortunately, I do not have any Apex or coding experience so I am in need of some assistance with the "tweaking" part. Would it be possible for you to help me out?

    Thanks
    Adam

    ReplyDelete
  15. Hi Javier,

    I have seen this application and i want this mechanism for Lead object instead of Cases. So could you please share the code which you modified in order to work with lead object.

    Regards,
    Adi.

    ReplyDelete
    Replies
    1. Here's the modified code to handle both leads and cases. It was provided by Evan Donovan
      https://gist.github.com/1562280

      Delete
  16. I copied Evan's coding exactly as it is listed but I get the following error: Error: Compile Error: unexpected token: trigger at line 135 column 0

    Any thoughts?

    ReplyDelete
    Replies
    1. Both tweaked codes are listed in the same section with light grey headings. remove every thing below row 133 and it should work.

      Delete
  17. This comment has been removed by the author.

    ReplyDelete
  18. When copying the code from https://gist.github.com/1562280 I am receiving this error " Error: Compile Error: Invalid field TempOwnerId__c for SObject Lead at line 13 column 38"

    is it required to create this field some where before updating the apex?

    ReplyDelete
  19. The field is automatically created when installing the original package from the app exchange. If you are simply deploying the code, you will need to create the TempOwnerId__c field on the Lead object. It's a Text(18).

    ReplyDelete
  20. This custom round robin assignment for leads works great! I have it installed and working great in my enterprise edition salesforce instance! There is one issue I have come across while trying to set up our workflows in Salesforce using this.

    Our workflow is as follows: Leads come into the system from the web and are assigned to our 'round robin' queue we have set up using our assignment rules. This works fine. Then the system runs the round robin assignment and assigns the leads to the individual users in the queue. This is also working fine.

    The problem I am having is trying to assign a task. Once the leads have been dispersed to the individual users through the round robin assignment we want the system to assign a task to the lead owner for each lead to remind the individual users that a lead has been assigned to them and to contact that lead.
    I have created a workflow in salesforce that runs when a lead is created that creates an immediate task and assigns it to the 'lead owner' of the lead record. Problem is that the taks keeps being assigned to the default user in the system instead of the individual user that was assigned to the lead by the round robin assignment.
    Now I'm not positive but I believe what is happening is that the workflow rule is being run BEFORE the round robin assignment runs so when the system creates the task and tries to assign it to the 'lead owner' it is still showing the 'round robin queue' as the owner and since you cannot assign a task to a queue it ends up assigning the task to the default owner of the workflow. Can someone confirm/deny that this is the case? And also, does anyone have any suggestions as to how to overcome this hurdle?

    Any help is appreciated!

    Thanks,

    Richard

    ReplyDelete
  21. Hi Richard,

    I am at the same road block, I tried an ISCHANGED function but apparently that won't reference the fields.

    I've put this on the back burner for now, but would like to problem solve it at some point.

    I know ques has an "email owner" function, but im not sure if this working with RRLA.

    ReplyDelete
  22. I feel like such a newb. Can someone please help. I installed the app onto my sandbox environment. I then tried copying the code from Evan Donovan on GIT Hub onto the existing case trigger but it fails with a Error: Compile Error: Trigger name exists on different SObject type: Case at line 3 column 1? So do I need to try and create new triggers or copy the code over in the existing trigger. I really know nothing about the apex code.

    ReplyDelete
  23. Replace the code in the existing trigger with the code from Evan.

    ReplyDelete
  24. Hey guys.

    I am at my wits end here. I cannot, for the life of me, no matter how much I alter the code from Evan, get my production environment to accept the triggers. It simply will not pass the 75% coverage barrier. I have used the exact code from Evan, and modified my apex class to test them, but nothing will work. I am exporting change sets through SF sandbox mode.

    Can anyone, please, help me get this to work?

    ReplyDelete
    Replies
    1. Were you able to get past the test coverage barrier? I am facing the same issue it works out fine in developer edition but has no code coverage when deploying to Prod.

      Delete
  25. This comment has been removed by the author.

    ReplyDelete
  26. I was curious as to if anyone had any luck fixing the testing class on this yet to get it usable in production?

    ReplyDelete
  27. I just wanted to follow up and say that I've been able to port this over to leads and have it deploy to production successfully. I'll be doing a write-up within the next few days and will have a public link on my G+ profile for anyone else searching for this.

    ReplyDelete
  28. Hi all, Matt was very helpful and provided me with additional code that seems to be working in my developer account: https://github.com/msutkowski/salesforce-roundrobin-mod

    Create the Apex class in develop in Salesforce developer.
    Attach the triggers to the objects (customize for standard lead object, and create --> objects for custom object).

    I am trying to get this deployed. I have done research but do not know how to deploy. Any insights appreciated.

    ReplyDelete
  29. To all having test case coverage issues - Make sure your System Admin account has Assignment Group Active checked then rerun test/deploy.

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Hi, I have managed to create the custom trigger and text class based on Matts code, but it flat out won't pass any tests.

    I've checked Assignment Group Active on my users (SysAdmin profile)

    Can anyone help? To test this I'm going to Develop>Apex Test Execution and selecting matt's Test class.

    Error below

    Class: TestMethodClsLeads1
    Method Name: myTest1
    Pass/Fail: Fail
    Error Message: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Lead, original object: QueueSobject: []
    Stack Trace: Class.TestMethodClsLeads1.myTest1: line 57, column 1

    ReplyDelete
  32. I wish I could help. My knowledge of Apex is enough to allow me to hack other people's code and make it work for our needs. You may want to post the error on the Salesforce Developer forums. I'm sure someone there will be able to point you in the right direction.
    http://boards.developerforce.com/sforce/?category.id=developers

    ReplyDelete
  33. Hi Javier, I managed to get in touch with Matt from the posts above and he's kindly helped me sort it

    ReplyDelete
  34. @MrCairney
    I am facing the same issue when using the code. Can you provide me the solution.

    ReplyDelete
  35. I am having an issue I can't understand. When deploying to my production org I get the following failure:

    # Deploy Results:
    File Name: package.xml
    Full Name: package.xml
    Action: NO ACTION
    Result: FAILED
    Problem: Cannot deploy InstalledPackage in Package Manifest with any other types!

    I have no idea what this means or how to fix it. If anyone can help that would be great.

    ReplyDelete
  36. This comment has been removed by the author.

    ReplyDelete
  37. Hello
    This is sophia miller, Thanks for Sharing.

    Get the Best Assignment help in Australia.

    ReplyDelete
  38. Best Web and Mobile Application solution provider Locus Rags in India.

    ReplyDelete
  39. Whenever assignment deadline are getting closed student start worry about who make my assignment? In this situations hire the profound writer from Student Assignment Help who provides a quality guaranteed solution with plagiarism free content.

    ReplyDelete
  40. Very Nice Blog! This Blog is Totally Informative About University Assignment Help In Australia. If You Are Looking For University Assignment Help Provider Then You Should Definitely Go For Myassignmenthelpau.

    ReplyDelete
  41. Want to get good marks in complicated assignment? All the students look for services like australian assignment help that can help them in completing their assignments under the supervision of professionals. The active guidance of a professional writers will help the student in completing their assignment within the deadline at affordable price.

    ReplyDelete
  42. Get instant online assignment help from top professionals in Australia...We are one of the best writing service providers over there. You can expect best from us and we will also leave no stone behind in providing you best...

    ReplyDelete
  43. Nice Post....
    HP Printer Driver Is Unavailable While Printing: How To Fix It?
    Hey There, I am Sofia Carter. Sometimes, when trying to print urgent documents, the HP Printer Driver Is Unavailable on Windows PC. This problem prevents you from printing and that’s why, it would be strongly needed to fix this problem as soon as possible. If you are not proficient enough to deal with such an issue, don’t panic! Just try making connection with qualified engineers as they will assist you in no time. When you dial 24x7 helpline number you will be in connected with top-most techies. With their guidance you can solve it in a pinch.
    hp printer driver unavailable
    printer driver unavailable
    driver is unavailable printer

    ReplyDelete
  44. Suggesting good research paper topics is a cakewalk for them. For your convenience, our experts have assembled 100+ interesting research paper topics that can help you get started.

    ReplyDelete
  45. The appropriate techniques should be carefully selected. essay writing services

    ReplyDelete
  46. Well done on such an amazing post. I like where your ideology about the professional Essay Writing Service is going. When planning to order your assignments from a reliable portal, you should try the essay writing facilities by the LiveWebTutors platform. You will receive flawless essay solutions that can easily grab the highest possible scores for you in the shortest possible turnarounds.

    ReplyDelete
  47. event planner Zoom's stock was up about 3% after hours at the time of this writing after initially falling about 3% immediately following the announcement. letter for meeting, dinner get together invitation, how much do event planners make per event, virtual event swag bags and eventbrite registration page

    ReplyDelete
  48. The contents of this blog are always very interesting, educative and informative, I must commend you for the good work you are doing here, keep it up. Lagos state polytechnic post utme form

    ReplyDelete
  49. Excellent erudition article, thank you for posting such a great blog information, it contains wonderful and helpful tips. Keep up the good work, looking forward to more of such an elucidates reads... ku post utme past questions pdf

    ReplyDelete
  50. You wrote an informative post that is very helpful and informative. Therefore, I would like to thank you for the amount of effort you put into this article. You may also want to look at The 6 Benefits of Touch Typing. Throughout this blog, I have discussed the most useful benefits of touch typing.

    ReplyDelete
  51. love to play online rummy, but don't know about the rummy rules. Now no longer miss out winning real cash. Visit PlayRummy.com to learn how to play rummy.

    ReplyDelete
  52. Thankyou for sharig Great article keep it sharing it will help for me.
    Get in touch with Leeds Apps for a quick, no obligation quote for a mobile app or bespoke web application or to enquire about our data migration services or systems integration skills. Just visit our website or fill in the form below and a member of our team will contact you as soon as possible.
    bespoke software development Leeds

    ReplyDelete
  53. You can easily Buy Assignment Online from us we have provided the order now link for the assignment. You are suggested to check the complete details of the same from this page and contact us accordingly.

    ReplyDelete
  54. This comment has been removed by the author.

    ReplyDelete
  55. Your idea is outstanding; this is something that few individuals are speaking intelligently about. I'm so delighted to have come across this amazing reads.. thanks for sharing. download free poly ede post utme past questions at www prep ng, visit Best Rated Educational Update Portal in the World; Examination and Academic Guide, High Paying Jobs & Scholarship  Website.

    ReplyDelete
  56. This exclusive Exodus walletfocused read is everything you’d need to understand the service along with steps to make transactions via your wallet accounts. You can read my blog with a click on the button above Exodus Crypto wallet

    ReplyDelete
  57. I really appreciate you for posting such a useful content, defnectly will implement the points which you have mentioned in the blog. HippoCloud is the top-ranked software (IT) training facility in Vizag, where it teaches freshmen or students to become professionals as well as professionals to become subject matter experts in their chosen technologies. https://hippoclouds.com/

    ReplyDelete