Entry Object

Introduction

The Entry object contains all properties of a particular entry (i.e. date created, client IP, submitted field values, etc…). It is formatted as an associative array with field Ids being the key to that field’s data.

Properties

PropTypeDescription
idintegerThe unique ID assigned to the entry by the database.
form_idintegerThe ID of the form the entry was created by.
created_bynull|integerNull or the ID of the logged-in user who submitted the form.
date_createdstringThe UTC date and time the entry was created.
Format: YYYY-MM-DD HH:MM:SS
date_updatedstringThe UTC date and time the entry was most recently updated.
Format: YYYY-MM-DD HH:MM:SS
is_starredbool|integerIndicates if the entry has been starred (i.e., marked with a star).
true or 1 when starred.
false or 0 when not starred.
is_readbool|integerIndicates if the entry has been viewed.
true or 1 when viewed.
false or 0 when not viewed.
ipstringThe IP address of the user who submitted the form.
source_urlstringThe URL of the request that saved the entry, limited to 200 characters. Usually, the URL of the page where the form is embedded. It can also contain the Admin Ajax or REST endpoint URL if the entry was created by an Ajax or REST API request.
post_idnull|integerNull or the ID of the post created by legacy post fields.
This is not used by the Advanced Post Creation add-on.
user_agentstringThe user agent string (limited to 250 characters) from the browser the user used to submit the form. Helps identify the browser, operating system, and device used to submit the form, but it can be unreliable.
statusstringThe current status of the entry.
Possible values: active, spam, trash
currencystringThe three character ISO 4217 currency code used by the submission for any pricing fields and payment add-ons.
payment_statusnull|stringNull or the status (limited to 15 characters) of the transaction processed by a payment add-on.
Possible values: Authorized, Paid, Processing, Pending, Active, Expired, Failed, Cancelled, Approved, Reversed, Refunded, Voided, or a custom value set by a third-party add-on.
payment_datenull|stringNull or the UTC date and time the transaction was processed.
Format: YYYY-MM-DD HH:MM:SS
payment_amountnull|integer|floatNull or the transaction amount without the currency symbol.
transaction_idnull|stringNull or the ID of the transaction returned by the payment gateway.
is_fulfillednull|bool|integerIndicates if the entry/order has been fulfilled.
true or 1 when fulfilled.
false or 0 when not fulfilled.
transaction_typenull|integerIndicates the transaction type of the entry/order.
1 for a one-time payment (product/service type feed).
2 for a subscription.
source_idnull|integerNull or the ID of the post or page where the form was embedded at the time the entry was saved.
Since Gravity Forms 2.9.
...[Field or Input ID]mixedEach field or input value is accessible in the entry using the field or input ID as the key to the value.
...[Meta Key]mixedAdd-ons can register additional meta, some of which is accessible in the entry using the meta key as the key to the value.

Usage

rgar( $entry, 'date_created' ); // returns the entry date
rgar( $entry, '1' );    // returns the value associated with field 1 (This would be for fields with single input like Text, Number, Drop Down, etc...)
rgar( $entry, '1.3' );  // returns the value associated with the first name portion of a simple name field 1
rgar( $entry, '1.6' );  // returns the value associated with the last name portion of a simple name field 1
rgar( $entry, '2.4' );  // returns the value associated with the state input for the address field 2
rgar( $entry, '5.1' );  // returns the field label for a single product that has id 5
rgar( $entry, '5.1' );  // returns the field label for a single product that has id 5
GFCommon::to_number( rgar( $entry, '5.2' ) );  // returns the field price, without currency symbol, for a single product that has id 5
rgar( $entry, '5.3' );  // returns the field quantity for a single product that has id 5

List Field

The List field type due to its complex setup compared to other field types (it has many rows and columns of data) it’s stored in serialized format, so you need to unserialize it first to access the data.

maybe_unserialize( rgar( $entry, '3' ) ); // unserialize values associated with list field 3

Checkboxes Field

The easiest way to get the checked checkboxes would be to get a comma separated string containing the selected choices without accessing each input in the entry and building the string yourself would be to use the get_value_export method of the field object, here’s an example

$field_id = 18; // Update this number to your field id number
$field = GFAPI::get_field( $form_or_id, $field_id );
$value = is_object( $field ) ? $field->get_value_export( $entry ) : '';

That would return a comma separated list containing the values for the selected choices, if you wanted to use the choice text, then you would use the following.

$value = is_object( $field ) ? $field->get_value_export( $entry, $field_id, true ) : '';

You can then convert that comma separate list to an array, if you like, using PHP’s explode() function.

Add-On Field Values

See the following pages for details about the entry values for fields added by add-ons:

Entry JSON

This example shows how an entry array would look when formatted as JSON for use by the Gravity Forms CLI Add-On.

{
    "1": "Third Choice",
    "2": "This is text content",
    "id": "1",
    "form_id": "1",
    "date_created": "2016-03-22 19:13:19",
    "is_starred": 0,
    "is_read": 0,
    "ip": "192.168.50.1",
    "source_url": "http:\\/\\/local.wordpress.dev\\/?gf_page=preview&id=1",
    "post_id": null,
    "currency": "USD",
    "payment_status": null,
    "payment_date": null,
    "transaction_id": null,
    "payment_amount": null,
    "payment_method": null,
    "is_fulfilled": null,
    "created_by": "1",
    "transaction_type": null,
    "user_agent": "Mozilla\\/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/48.0.2564.116 Safari\\/537.36",
    "status": "active"
}