Documentation

gwp_get_matched_entry_value

The gwp_get_matched_entry_value modifier (or merge tag) can be used to retrieve values from entries from another form, based on a shared value. By default this modifier only returns entry values if you configure the access settings in Form Settings -> Advanced Merge Tags.

:gwp_get_matched_entry_value form_id= match_id= return_id=

{gwp_get_matched_entry_value value= form_id= match_id= return_id=}

The minimum requirements when using the Modifier are:

  • form_id: ID of the Form you want to search through.
  • match_id: ID of the Field within that Form you want to match the value of the Merge Tag’s field value to.
  • return_id: ID of the Field that you want to get the value from.

When using it as a Merge Tag you also need to specify the value:

  • value: The value you want to match with the value of the match_id field’s value.

Besides a numeric field-id the following properties are also supported for match_id and return_id:

idThe entry’s ID
created_byID of the logged in user that submitted the form
date_createdThe date and time the entry was created, in the format “yyyy-mm-dd hh:mi:ss” (i.e. 2022-01-31 14:46:51)
ipClient IP of the user who submitted the form.
is_approvedGravity View entry approval status. The Gravity View {approval_status} documentation gives insight in possible values. E.g. 1 = Approved.

Optional arguments:

  • sort_by: Sort by field or entry property. Use the field-id or the entry property like ‘date_created’. (Default is ‘id’)
  • sort_order: Sorts in a certain direction. This can be either asc (ascending) or desc (descending). Default is ‘desc’.
  • offset: Skips the number of entries specified.

Apply filters

You can also apply filters to the gwp_get_matched_entry_value Modifier and Merge Tag. This filter is executed before picking the first result (or offset), so this way you’re able to only get a matched entry value back with certain criteria.

Example of the Modifier with two filters filters:

{Text:1:gwp_get_matched_entry_value form_id="2" match_id="4" return_id="6" filter1="3" operator1="isnot" value1="Choice 1" filter2="created_by" operator2="is" value2="1"}

The same applies when you use the Merge Tag:

{gwp_get_matched_entry_value value="Something" form_id="2" match_id="4" return_id="6" filter1="3" operator1="isnot" value1="Choice 1"}

Allowing access to other form fields

To prevent unintended data leakage access to another forms entry values by this merge tag modifier are not allowed by default (‘No access’). Before you allow access you must think about if a user / visitor is able to change the match value and therefore able to retrieve data from other entries the user / visitor might not be allowed to see. Acces can be allowed in the ‘Advanced Merge Tags’ tab in the Form Settings. Generally it is advised to only allow access to form fields which do not contain sensitive information.

Form Settings – Advanced Merge Tags

Example

A real life example. You have a Gravity Form with data about schools (in the Netherlands, schools have an unique ID, which looks like this: 99ZZ). Every school has such a unique identifier. Imagine that you have another Form on your site for Dutch teachers. They can easily fill in their unique school ID.

Based on this unique code, you want to find a match with the school and retrieve more data about the school, for example the address, telephone number or a postal code.

Let’s see how we can quickly do that with using the gwp_get_matched_entry_value Merge Tag:

Form A: for teacher form_id=1

Field IDField LabelEntry example
1School BRIN number99ZZ
2Name TeacherJohn Doe

Form B: with School data form_id=2

Field IDField LabelEntry example
1School namePrimary School the Balloon
2AddressStreetname 3, 2801SX, Gouda
3Telephone+310700000001
4School BRIN number99ZZ

Use Merge Tag Modifier in Form A

After the teacher submits her Form, you send an e-mail. In the e-mail you want to show the school name that matches with the unique BRIN id. When we use the Merge Tag without modifiers, it will return the BRIN number:

{School BRIN ID:1}9977

Now we want to find the school name. We can do that by adding our Modifier like this:

{School BRIN ID:1:gwp_get_matched_entry_value form_id=2 match_id=4 return_id=1} Primary School the Balloon

Other examples

With sort_order=asc: returns the oldest entry value.

{Textfield:1:gwp_get_matched_entry_value form_id="2" match_id='1' return_id=2 sort_order=asc}

With offset=1: returns the second oldest entry value.

{Textfield:1:gwp_get_matched_entry_value form_id="2" match_id='1' return_id=2 sort_order=asc offset=1}

If you want to match a fixed value you can use the Merge Tag variant:

{gwp_get_matched_entry_value value="9977" form_id="2" match_id=1 return_id=2 sort_order=asc offset=1}

Frequently Asked Questions

What does gwp_get_matched_entry_value do?

This modifier lets you pull a single value from another Gravity Form based on a matching field. It’s perfect for showing a related name, code, or status without needing to display all entries—just the newest one that matches.

Example:
{Company ID:1:gwp_get_matched_entry_value form_id=40 match_id=4 return_id=2}

This fetches the Employee Name (field 2) from Form 40 where Company ID (field 4) matches the current form’s Company ID (field 1)

What’s the difference between gwp_get_matched_entry_value and gwp_get_matched_entries_values?

Use gwp_get_matched_entry_value when you only want one field from the newest matched entry.
Use gwp_get_matched_entries_values when you want to pull multiple fields from multiple entries.

Examples:
{Company ID:1:gwp_get_matched_entry_value form_id=40 match_id=4 return_id=2}     ← one result
{Company ID:1:gwp_get_matched_entries_values form_id=40 match_id=4 return_id1=2 return_id2=3}  ← multiple

How can I get the oldest match or skip some entries?

You can use sort_order=asc to return the oldest matching entry. To skip results, use offset=1 to get the second match, and so on.

Example:
{Company ID:1:gwp_get_matched_entry_value form_id=40 match_id=4 return_id=2 sort_order=asc offset=1}

This fetches the second oldest Employee Name for the same Company ID.

Can I add filters to control which entries are matched?

Yes, you can apply filters just like in the plural version. Use filter1, operator1, and value1 to limit which entries are considered before selecting the top result.

Example:
{Company ID:1:gwp_get_matched_entry_value form_id=40 match_id=4 return_id=2 filter1="3" operator1="isnot" value1="archived"}

This only matches entries where Field 3 is not “archived.”

Why isn’t my merge tag returning anything?

There are three main reasons:

-The form or field IDs (form_id, match_id, return_id) are incorrect.
-No entry matches the value you’re passing in.
-You haven’t granted access to the target form’s fields.

Go to the target form and check Settings > Advanced Merge Tags > Entry Access. Allow access to only the necessary fields to prevent data leaks.

Last updated: 18-07-2025

Advanced Merge Tagsv1.9.3

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more