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.autoAddto 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.