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.