This little snippet will copy an entry_id that has just been created to a custom field in the same entry.

Why might you want to do this? Imagine you had a form that was the basis of a ticketing system and the Entry_ID, which is unique to every entry through Gravity Forms, is a convenient piece of information to use for something like a receipt or unique reference number. I needed to be able to track form entries over the course of 18 months, identifying entries from the same person. Simply copy the below into your theme functions.php file changing the information below to suit your specific form.

// Change '1' to your form ID
add_filter( 'gform_after_submission_1', 'replace_entry_id', 10, 2 );

function replace_entry_id( $entry ) {

    $identifier_id = rgar( $entry, 'id');
    
    // Change '25' to the field you want to copy the entry_id to
    $value = rgar( $entry, '25');

    if ( !$value ) {
        
        // Change '25' to the field you want to copy the entry_id to
        $result = GFAPI::update_entry_field( $identifier_id, '25', $identifier_id );
        return $result;

    }

}