Distributing New Records

Hi Guy's

I'm trying to figure a way to evenly distribute new records to salespeople (4)

In this case, each record is a sales lead and needs to distribute the record evenly, one each etc (we have 4 but could be more). This is called round-robin distribution.

I'm not efficient enough with JS, perhaps it could be done that way. Any ideas?

I don't believe there's a way to inspect the previous record etc as this would make it easy.

Any help appreciated

Hi Phil

I've managed to do this with 3 Tables and a single Zap (not using Zapier Storage). The tables are:

Sales People

- Sales Person Name (Short Text / Unique)

- Next Sales Person (Connection to Sales People)

Next Sales Person

- Type (Short Text / Unique - for searching for the SINGLE RECORD required here)

- Next Sales Person (Connection to Sales People)

Leads

- Leads Name (Short Text / Unique)

- Assigned to (Connection to Sales People)

You then can set up a 5 step Zap which will:

  1. Trigger from a new record in Leads
  2. Find the Next Sales Person from Next Sales Person object (using the Type to find the record)
  3. Update the lead record's Assigned to field from step 1 with the Next Sales Person from Step 2
  4. Find the Sales Person record for the Next Sales Person found in 2
  5. Update the Next Sales Person record (using the ID from 2), setting the Next Sales Person found in 4 (Use a custom value for the Next Person Name field)

Assuming you have set up your Sales people in a circular loop - i.e. the last person's Next Sales Person is the first person in the list - then this should work indefinitely - and you can always edit the next person by updating the Next Person Object manually. Also, the Type field means that you could have a number of different sequences if you need to.

Note that although this is an instant Zap it's probably not going to show the update on the parent table if you have the form Submit Rule set to Redirect to the parent page (which I normally do).

Thanks Julian. However I'm embarrassed to say, I cant think how I'd do this in Zapier, now I use Zapier a lot too. Could you explain a little more, it would be appreciated?
Many thanks

Hi Phil

The logic for this could easily built with Zapier (store the ID of the next salesperson in Zapier Storage). You could also do the same with Integromat but it wouldn't happen instantly

To do this in the database, you could hold a value for the next salesperson on each one's record (using a number or even a connection).

Much simpler than struggling with Javascript and much easier to maintain.

Hope this helps.

Julian