Round Robin with record-triggered Flow

Job ID: 36183011

Budget: €8 – €30 EUR

I want to do a round robin maintaining the lead assignment rule, like this: https://www.kicksaw.com/blog/how-build-round-robin-salesforce

You’ll need to know how to do the following in Salesforce:
Experience developing Flow in salesforce, because you need:
Create an record-triggered flow
Create custom objects
Create custom fields
Create 2 o 3 lead assignment rules for test
Create 2 or 3 lead queues for test

Bussines logic:
Record-Triggered Flow
Object: Lead

Resources:
variable date time formula: NOW_Formula

Object 2: Round_Robin_Lead__c
Criteria: IsActive = True AND Name = {!$Record.Owner:Group.DeveloperName}

Object 3: Round_Robin_Assignee__c
Criteria: IsActive = True AND Round_Robin_Lead__c = {!Get_Round_Robin_Record.Id}
Sort Order: Ascending Last_Assigned__c

Logic elements:

get element 1: get Round_Robin_Lead__c

decision element 2: Is Round_Robin_Lead__c found?
Yes:
get element 2: get Round_Robin_Assignee__c

decision element 2: Is Round_Robin_Assignee__c found?
Yes:
update element 1:
Update Lead Owner – This element is where the lead’s owner will be updated to the round robin assignee. The element first queries a lead whose ID is the same as the ID of the lead that is moving through this flow (which is contained in the RecordId flow resource that you will populate later with a record-triggered flow). Set the OwnerId of the lead to the User field of the round robin assignee record.
Set Field Values for the Lead Records for this update element 1: OwnerId <-- {!Get_Round_Robin_Assignee.User__c}

update element 2:
Update Round Robin Assignee Date Assigned – This element updates the Last Assigned datetime field on the round robin assignee record with the current date and time. It first retrieves the assignee record whose ID field matches the ID of the assignee we found earlier in the flow, then it sets the Last Assigned field to the NOW_Formula resource you created earlier.
Criteria filter found for this update element 2: Id = {!Get_Round_Robin_Assignee.Id}
Set Field Values for the Round Robin Assignee Records for this update element 2: Last_Assigned__c <-- date_Formula

action element: Alert email

Requirements:
The OwnerId of the Lead record must be updated with the user chosen in the round robin.
The Flow of the example works perfectly when a single record of the Lead object is created or updated, but if a massive update is made, all the records of the Lead object are assigned the same Assignee. So I want the correct assignment to be taken into account when a massive update is also made, for each Lead an appropriate Assignee assignment must be made.

That all the logic be added in a single flow if possible, but if not, it can be created in two Flows, the record-triggered one and another flow with the round robin logic that will be called in the record-triggered flow, which will be triggered by the creation or update of a record of the lead object, and this will have a subflow element, which calls another Flow Autolaunched (not trigger), with the round robin logic.

Another necessary element in the logic Flow, to correctly assign a user to the Lead record, so that in the next Lead record the assignment of the next user in the list is made.

Example of what I want to avoid:

I want to avoid that when a massive update of Lead records is made, they are all given the same user assignment. Example we load 3 Lead, those 3 Lead will be updated with the same round robin user.
What I want is for each Lead record to be assigned a different user from the round robin user list. With the current logic, all the Lead records are affected by the same user, this is not correct, if we update 200, 2000... all the Lead records will have the same user... Bad issue.