Gravity Forms Entry Objects

A list of Gravity Forms Entry Objects

Prop Type Description
id integer The unique ID assigned to the entry by the database.
form_id integer The ID of the form the entry was created by.
created_by null|integer Null or the ID of the logged-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|integer Indicates if the entry has been starred (i.e., marked with a star).
true or 1 when starred.
false or 0 when not starred.
is_read bool|integer 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 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_id null|integer Null or the ID of the post created by legacy post fields.
This is not used by the Advanced Post Creation add-on.
user_agent 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: activespamtrash
currency string The three character ISO 4217 currency code used by the submission for any pricing fields and payment add-ons.
payment_status null|string Null or the status (limited to 15 characters) of the transaction processed by a payment add-on.
Possible values: AuthorizedPaidProcessingPendingActiveExpiredFailedCancelledApprovedReversedRefundedVoided, 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 processed.
Format: YYYY-MM-DD HH:MM:SS
payment_amount null|integer|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|integer Indicates if the entry/order has been fulfilled.
true or 1 when fulfilled.
false or 0 when not fulfilled.
transaction_type null|integer 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|integer Null 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] mixed Each field or input value is accessible in the entry using the field or input ID as the key to the value.
...[Meta Key] mixed Add-ons can register additional meta, some of which is accessible in the entry using the meta key as the key to the value.

 

Entry object use examples

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

Exceptions

List Field

List field type has a complex structure:

  • with multiple rows and columns:
    • stored in a serialized format.

You must first unserialize the field:

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

 

Checkboxes Field

easily obtain a comma-separated string of selected checkboxes:

  • without manually iterating through each input,
    • use the get_value_export method of the field object.
      • For 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 ) : '';

 

get_value_export method returns:

  • a comma-separated list of the values for selected choices.
    • …to retrieve the actual choice text instead:
      • use a different approach (below):
$value = is_object( $field ) ? $field->get_value_export( $entry, $field_id, true ) : '';

 

Want to convert the comma-separated list into a PHP array?

Use PHP’s explode() function.

Was this article helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *