How to Improve Backlink Profile? GSA Verified Guideline

Known to many with GSA Search Engine Ranker one will never have to care about backlinks ever again. Because, this software builds backlinks for you 24 hours a day, 7 days a week. But, one should know…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Salesforce Trigger for Lead Round Robin Assignment

We can assign leads to the users in a particular queue through round robin algorithm in many ways. I tried to implement this functionality programmatically by using custom settings and apex triggers in this post.

Round robin assignment is nothing but distribution of leads among the group of people in a rotational manner. Suppose if there are 3 reps in the queue and we want to distribute the leads in round robin manner then

For this one, first step is to create a queue named “Lead Queue” and add some users to that. Whenever a lead is assigned to that queue, we need to reassign the lead to one of the users in the queue in a Round robin manner using Trigger.

We need to know for what user in the queue that we assigned the last lead. So for that we are going to use custom settings to hold the index of the last assigned user in the queue. Next step is to create a custom settings named “Lead Round Robin Assignment” and the custom field named “User Index” as shown below.

Custom settings to hold the index of last lead assigned user

Also create a new record for Lead round Robin assignment custom settings and set the value of user index to -1.

Final step is to write the trigger on lead to reassign the leads in a round robin manner

In order to test these changes insert some test leads with this anonymous code:

Check for the above inserted leads and you can see that the leads are assigned to the users in a round robin manner.

We can also update the logic based on the working hours of the reps too and will try to explain it in another post. That’s it for now.

Add a comment

Related posts:

Learning Patterns

I am a contortionist to your extortion habit, your blind assumptions bred from overconsumption of your thought process; that mad mess from over obsessing, living in sadness. Fake politeness behind…

What Would You Be Willing to Give Up for What You Think Is Right?

1 book that will seriously make you think about philosophy and the worth of your opinion: Socrates's Apology

Save YouTube Video to Google Drive Tutorial

Have you ever seen a YouTube video you liked so much you wanted to keep it forever? With the way YouTube hands out copyright strikes like free candy, it’s best to save what you can, when you can. Any…