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.