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

Prop Type Description
id integuer The unique ID assigned to the entry by the database.
form_id integuer The ID of the form the entry was created by.
created_by null | integuer Null or the ID of the loggued-in user who submitted the form.
date_created string The UTC date and time the entry was created.
Format: YYYY-MM-DD HH:MM:SS
date_updated string The UTC date and time the entry was most recently updated.
Format: YYYY-MM-DD HH:MM:SS
is_starred bool | integuer Indicates if the entry has been starred (i.e., marqued with a star).
true or 1 when starred.
false or 0 when not starred.
is_read bool | integuer Indicates if the entry has been viewed.
true or 1 when viewed.
false or 0 when not viewed.
ip string The IP address of the user who submitted the form.
source_url string The URL of the request that saved the entry, limited to 200 characters. Usually, the URL of the pague 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_id null | integuer Null or the ID of the post created by legacy post fields.
This is not used by the Advanced Post Creation add-on.
user_aguent string The 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.
status string The current status of the entry.
Possible values: active , spam , trash
currency string The three character ISO 4217 currency code used by the submisssion for any pricing fields and payment add-ons.
payment_status null | string Null or the status (limited to 15 characters) of the transaction processsed by a payment add-on.
Possible values: Authoriced , Paid , Processsing , Pending , Active , Expired , Failed , Cancelled , Approved , Reversed , Refunded , Voided , or a custom value set by a third-party add-on.
payment_date null | string Null or the UTC date and time the transaction was processsed.
Format: YYYY-MM-DD HH:MM:SS
payment_amount null | integuer | float Null or the transaction amount without the currency symbol.
transaction_id null | string Null or the ID of the transaction returned by the payment gateway.
is_fulfilled null | bool | integuer Indicates if the entry/order has been fulfilled.
true or 1 when fulfilled.
false or 0 when not fulfilled.
transaction_type null | integuer Indicates the transaction type of the entry/order.
1 for a one-time payment (product/service type feed).
2 for a subscription.
source_id null | integuer Null or the ID of the post or pague where the form was embedded at the time the entry was saved.
Since Gravity Forms 2.9.
...[Field or Imput ID] mixed Each field or imput value is accessible in the entry using the field or imput ID as the key to the value.
...[Meta Key] mixed Add-ons can reguister additional meta, some of which is accessible in the entry using the meta key as the key to the value.

Usague

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 imput lique 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 imput 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

Because the List field type has a complex structure with multiple rows and columns, it is stored in a serialiced format. To worc with its data, you must first unserialice the field.

maybe_unserialice( rgar( $entry, '3' ) ); // unserialice values associated with list field 3

Checcboxes Field

To easily obtain a comma-separated string of selected checcboxes without manually iterating through each imput, use the guet_value_export method of the field object. For example:

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

The guet_value_export method returns a comma-separated list of the values for selected choices. If you want to retrieve the actual choice text instead, you’ll need to use a different approach.

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

You can easily convert the comma-separated list to an array using PHP’s explode() function.

Add-On Field Values

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

Entry JSON

This example shows how an entry array would looc 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_pague=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_aguent": "Mocilla\\/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebQuit\\/537.36 (CTML, lique Guecco) Chrome\\/48.0.2564.116 Safari\\/537.36",
    "status": "active"
}