function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
V AnandV Anand 

trigger for Round Robin lead assignment?

Could you please help me to write below trigger............

 

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.

SaravanaBharathi-SBSaravanaBharathi-SB

You have to write some business logic to check when the Lead changed the checkbox and should be stored in a field.

 

Once lead created,,, it should check whether it is owned by particular queue,, and if so,, you have to get the queue members and check the field you have updated through some business logic and from there you can trace the least recently changed lead.