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.
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.
- Using the Snippet
- Taking It Further
Using 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.
Update Snippet with Form and Field ID
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 ) );
When the form is submitted, the snippet will cycle to the next value in the Drop Down for every submission.
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
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.