1

I'm a young Apex developer. I have a quick question:

I would like to dynamically assign new records to users using an Apex trigger. As we know, every new created records are automatically assigned to the current logged in user.

I am trying to create a trigger that assigns the leads between the 2 users equally. The solution should count the number of leads assigned to each user, so that we have similar number of leads assigned to each user.

For example: - You have User C and User D - You mass insert 7 lead records - Leads 1, 3, 5 and 7 are assigned to User C - Leads 2, 4 and 6 are assigned to User B

2
  • As an alternative, have you thought about using a Lead Queue and letting the Reps pull from there? Commented Mar 26, 2014 at 21:34
  • You could also use Lead Assignment Rules. Possibly in conjunction with lead queues. Commented Mar 26, 2014 at 21:34

1 Answer 1

3

What you're looking for is called "round robin" assignment.

1) If you want to custom build it, you can find the approach on a similar question that I've answered for Cases and Accounts here. You would need to do the same thing for the users and leads.

2) There is an app called "Round Robin Record Assignment" on the appexchange, I personally haven't tried it, but looks like it does what you need and it's free.

3) You can also achieve this by creating a couple of custom fields and assignment rules. A very good example can be found here

1
  • Thank you so much for your reply. I will look to this and back with the answer. Thank you !
    – Constantin
    Commented Mar 26, 2014 at 22:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .