Gravity Forms Round Robin

Distribute leads evenly to a group of sales reps, schedule employees for the next available shift, or balance the responsibility of any task-oriented submission (e.g. support requests, job applications, contest entries).

March 7th, 2024: Added support for excluding GP-Inventory-enabled choices with exhausted inventory.

January 10, 2022: Added support for rotating through choices dynamically populated by GP Populate Anything.

September 26, 2020: Added support for limiting how many times a given choice is selected by Round Robin via GP Limit Choices.

Overview

Imagine you have a form where you’d like to automatically cycle through the choices of a designated field with every entry. The cycle starts with the first choice, progressing to the next available choice on each submission. After each choice has been assigned, it will restart from the first option.

The practicality of this is for any task-oriented form, such as sales leads, support requests, or a shift scheduler. Whatever choices are stored in the choice-based field will be cycled for each submission, evenly distributing the values across all submissions in a first-in-first-out basis.

  1. Overview
  2. Using the Snippet
    1. Prerequisites
    2. Add a Drop Down Field
    3. Update Snippet with Form and Field ID
    4. That’s It!
  3. Parameters
  4. Taking It Further

Using the Snippet

Prerequisites

Confirm that you have Gravity Forms installed and activated and that you’ve installed the snippet.

Add a Drop Down Field

With the snippet installed, add a Drop Down Field to your form and set the choices to the different values you want to cycle through. This field will automatically be hidden by default.

Check out Populate Anything for an easy way to dynamically populate the choices in the Drop Down.

Update Snippet with Form and Field ID

Update the form_id and field_id in the snippet to match your Form ID and the Field ID for your Drop Down from above.

new GW_Round_Robin( array(
	'form_id' => 123,
	'field_id' => 4
) );

That’s It!

When the form is submitted, the snippet will cycle to the next value in the Drop Down for every submission.

Parameters

  • form_id (integer) (required)

    This is the Form ID where you want to cycle through the choices. There is no default value.

  • field_id (integer) (required)

    This is the Field ID for the field where the choices are stored. There is no default value.

  • hide_field (boolean) (optional)

    Automatically hide the choice-based field. The default value is true.

Taking It Further

This snippet should be considered a building block to create round robin forms. For an example of how this can be implemented in a real world scenario, check out the How To Evenly Distribute Leads to a Sales Team with Gravity Forms tutorial.

Comments

  1. J Hay
    J Hay June 7, 2024 at 12:02 am

    Hi all! Looking for a software that allows a particular project (a writer sends a .pdf doc) to be submitted to a pool of workers (say proofreaders) and based on their availability they could pick up the document, proofread it, and then send for verification. And there would also be a pool from which verifiers, if available, could choose to pick up the document to verify and then send for final approval (to 2 people who each have to approve). Then if they reject it for any reason the document would leave to go to the original writer and then go back to the original proofreader (not into the pool), then verify pool, then approver(s). Hopefully that makes sense! I’m struggling to know what software would allow a document to be based around as fast as possible – while ideally keeping the most “up to date version” accessible with prior versions in archives. Is this something your tools can provide?

    Reply
  2. Godwill Barasa
    Godwill Barasa May 5, 2022 at 7:27 am

    I get this error : Uncaught Error: __clone method called on non-object in /var/www/vhosts/clients.belva.co.ke/httpdocs/mivida/wp-content/plugins/GF-AutoAssign/gf-autoassign.php on line 146

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff May 5, 2022 at 8:14 am

      Hi Godwill,

      That error message doesn’t appear to be related to the Round Robin snippet. It looks like an issue with the GF AutoAssign plugin on your website. I’ll suggest you get in touch with the developer of that plugin.

      Best,

  3. Chris
    Chris November 28, 2021 at 3:09 pm

    Hello, Is it possible to have each form submission sent to multiple recipients from the Round Robin Emails field? I would like an option to change the number of recipients to 3 (or any value I enter) … something like:

    new GW_Round_Robin( array( ‘form_id’ => 123, ‘field_id’ => 4, ‘form_recipients’ => 3 // number of recipients per form submission ) );

    Taking it further, would it be possible to have each recipient have (2) notifcation methods such as their email address and their mobile phone number as well (which are actually email addresses themselves)?

    In my ideal scenario, I would use the populate anything module to provide entries for the round robin module, and to “load” recipients based on the user role “advertiser” and to populate each of their entries with (2) values from their profile (the email address, and phone number).

    Thanks, and I hope this made sense!?

    Chris

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff November 29, 2021 at 6:51 am

      Hi Chris,

      The snippet as it is, wouldn’t be able to do what you want and will require some customization to get it working for you. If you have an Advanced or Pro Gravity Perks License, you can get in touch with us via our support form so we can take your request and forward it to our developers to see if this can be supported.

      Best,

  4. Newbie
    Newbie November 8, 2021 at 11:00 pm

    Great snippet. Lets say I have a website and I only want currently logged-in users to be selected. How would I do this or is it even possible to filter the dynamically populated list of users this way?

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff November 9, 2021 at 5:08 am

      Hi Newbie,

      I don’t think this is possible without some custom code because WordPress doesn’t have a built-in function to identify all currently logged-in users. You may need to custom code this functionality because you won’t be able to use GP Populate Anything as it is, to get a list of all currently logged-in users.

      Best,

  5. Chris
    Chris October 18, 2021 at 11:13 am

    Thanks this seems very helpful for lead distribution. Would you be able to go about getting duplicate leads to go to the same person? For example, someone has sent in a form entry and they forgot something so they submit another with more information.

    Thanks!

    Reply
  6. Kyle Rolfe
    Kyle Rolfe October 1, 2020 at 5:33 pm

    I’m having trouble getting this to work as well. It’s not automatically hiding the field and it doesn’t seem like it’s actually selecting any of the options either. I’m trying to sequentially assign 1 of 3 products on each submission, so I’m pretty sure this snippet is exactly what I’m looking for, but I can’t seem to figure it out.

    Here is the full functions.php file: https://snippi.com/s/as2mdcz

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Download Snippet

Gravity Forms Round Robin

This field is for validation purposes and should be left unchanged.