Unique Id Field for Gravity Forms


This plugin adds a button called ‘Unique ID’ to your Gravity Form Advanced Fields group. Add it to your form to automatically include a unique id with each successful submission.

Product Description

Generate a unique id in a hidden gravity form Unique Id Field.

This plugin adds a button called ‘Unique ID’ to your Gravity Form Advanced Fields group. Add it to your form to automatically include a hidden unique id field with each successful submission.

This plugin is superior to other ways of adding a unique value in that it populates the unique id on form load. It also checks to make sure it does not appear elsewhere in your Gravity Forms Lead Detail table Value field (including a unique id generated from another form). Just to make sure. I mean the odds are beyond slim, but just in case…

The Unique ID Field is prefixed with AZ_ but you can change that by adding this code to your functions file:

add_filter( 'az_gf_uid_filter', 'my_function_to_change_prefix');

function my_function_to_change_prefix ($prefix) {
   return 'XYZ_';

Change XYZ_ to what you would like for your prefix.

There is a filter to change the entire unique id if you want (added in 1.1):


function change_value_to_timestamp($value){
 return current_time('timestamp'); // change the unique id to the current timestamp using your WordPress timezone setting

Geek alert:

This plugin uses PHP’s uniqid function. Read more here: http://php.net/manual/en/function.uniqid.php

Get the value of the unque id after submission by input id if known : $unique_id = rgar( $entry, '24' )
or using GF API if not known.
$unique_id_fields = GFAPI::get_fields_by_type( $form, ['az_unique_id'] );
$unique_id = rgar( $entry, $unique_id_fields[0]->id );

Version 1.1
Compatible with GF 1.9.x and 2.x
Works with WordPress 5.x

Please use any text editor (like notepad) to open the readme.txt file located in your plugin for additional information.

Available hooks in the plugin:

Change the prefix from ‘AZ_’ before the id is generated:

$prefix = apply_filters( 'az_gf_uid_filter', 'AZ_' );

Filter the generated unique id:

$id = apply_filters( 'az_gf_value_filter', $id);

Related Products