Achieving true round-robin (not random) assignment with FlowBoost
As we know, Marketo doesnβt natively support round-robin distribution ofβ¦ well, of anythingβ¦ across different leads.
There is Random Sample, which gives an even distribution over time (given enough volume). But thatβs not appropriate for things like lead assignment, where you donβt want a salesperson to get 2 or 3 leads in a row while depriving their colleagues.
As a result, people tend to rely on SFDC or SFDC-integrated apps like RingLead. But you can do round-robin with just Marketo + FlowBoost, managing your own βqueuesβ for anything you want to distribute as A-B-C-A-B-C-A-B....
The pattern is simple:
- pass the current value as a {{lead.token}} (assuming you want to keep that if itβs already set)
- include the list of possible round-robin values as an array
- use
FBCounter.autoAdd
to increment a counter - get the current count from the counter
- use the
%
(remainder) operator to cycle through the list from top to bottom and start over from the top
Like so:
let counterName = "/round_robin_owners_2023-08-23/";
let currentOwner = {{lead.RR Owner}};
let leadOwners = [
"Jen",
"Sandy",
"Brendan"
];
if(currentOwner){
success({
ownerName : currentOwner
});
} else {
FBCounter.autoAdd(counterName)
.then( newEntry =>
success({
ownerName : leadOwners[newEntry.entryIndex % leadOwners.length]
})
)
}
Thatβll return a webhook response like:
{
"response": {
"ownerName": "Sandy"
}
}
And you map response.ownerName
to your RR Owner field.
Note when it comes to true SFDC Contact/Lead Owners β i.e. SFDC Users β you canβt assign them directly in the webhook response. Youβd trigger on the change to a String field (the RR Owner field above) and use Change Owner with Add Choice items.
Oh, one more thing!
Youβll need the query param ?authoringEnv=pro
in the FlowBoost URL. (Donβt worry, works with any API key including Community!)
This is because youβre not only updating the counter but reading the resulting count. Reading is a instant-but-asynchronous task, and waiting for async results only works in our Pro βauthoring environmentβ as we somewhat clumsily call it.