TutorialShow Previous Gravity Forms Submissions Using Advanced Merge Tags

Sometimes a new form submission needs more context.

For example, a returning customer submits another request using the same email address. Instead of checking the Gravity Forms Entries screen manually, you may want the confirmation message to show how many previous submissions used that email and the total value connected to those matching entries.

In this tutorial, we’ll build that workflow using GravityWP Advanced Merge Tags.

The demo uses a simple Customer Request Form. A visitor enters their email address, chooses a request type, and adds a request value. After submission, the confirmation message shows:

  • the number of previous submissions found for that email address
  • the total submitted value from matching entries

This tutorial is based on a tested Gravity Forms setup. We confirmed that gwp_count_matched_entries counted previous submissions by matching the email field, and gwp_sum_matched_entries_values calculated the total value from matching entries.

What You’ll Build in This Tutorial

You’ll create a Gravity Forms previous submissions summary based on an email lookup.

Here is the basic flow:

  1. A visitor submits the form using an email address.
  2. Advanced Merge Tags checks previous entries with the same email.
  3. The confirmation message shows how many previous submissions were found.
  4. The confirmation message also shows the total submitted value from matching entries.

In our demo, the form was called Customer Request Form.

Field labelField typeField ID in our demoPurpose
EmailEmail1Used to match previous submissions
Request TypeDrop Down3Sample request category
Request ValueNumber4Numeric value used for the total
Previous Submission CountSingle Line Text / Administrative5Optional field for storing the count
Total Submitted ValueSingle Line Text / Administrative8Optional field for storing the total

The key field is Email. Advanced Merge Tags uses the submitted email address as the matching value, then checks form entries that use the same email.

In this demo, the Form ID is 5. Your own Form ID will be different, so update the merge tags before using them on your site.

Customer Request Form fields used to show previous Gravity Forms submissions by email
The demo form uses Email as the matching field and Request Value as the numeric field for calculating totals.

Before You Start

You’ll need:

  • Gravity Forms installed and active
  • GravityWP Advanced Merge Tags installed and active
  • access to edit the form settings
  • a form with an Email field
  • a Number field if you want to calculate totals
  • a few test entries using the same email address

This tutorial uses the confirmation message because it is the simplest place to test the result. Once it works, you can also place the same merge tags in an admin notification or store the output in administrative fields.

Step 1: Create the Customer Request Form

Create a new form in Gravity Forms.

For this demo, we used a form called Customer Request Form with these visible fields:

Field labelField typeExample choices or value
EmailEmailreturning@example.com
Request TypeDrop DownSupport, Billing, Feature Request, General Inquiry
Request ValueNumber100, 200, 300, etc.

The Email field is used for matching. If the same email address appears in earlier entries, Advanced Merge Tags can count those matching entries.

The Request Value field is used for the total. Since it is a number field, Advanced Merge Tags can add the values from matching entries.

In our demo:

  • Email = Field ID 1
  • Request Type = Field ID 3
  • Request Value = Field ID 4
  • Form ID = 5

You can find your form ID in the Forms list or in the browser URL while editing the form.

Customer Request Form showing Gravity Forms previous submissions merge tags for count and total value
The demo form uses Advanced Merge Tags to count previous Gravity Forms submissions by email and calculate the total submitted value from matching entries.

Step 2: Set Field Access in Advanced Merge Tags

Next, allow Advanced Merge Tags to access only the fields needed for this lookup.

Go to:

Form Settings → Advanced Merge Tags

Set Entry access to:

Specify per field

In our demo, we allowed access to these fields:

FieldAccess level used in demoWhy access is needed
EmailEveryoneUsed as the matching value
Request TypeEveryoneSafe sample field in the demo
Request ValueEveryoneUsed for calculating the total

We used Everyone because the form is submitted on the front end, and the visitor may not be logged in.

Only allow access to fields that are needed for the lookup or calculation. Do not expose private notes, payment details, personal data, or internal admin-only fields unless your workflow truly requires it.

Advanced Merge Tags field access settings for Gravity Forms previous submission lookup
Only allow access to the fields needed for the lookup and calculation, such as Email and Request Value.

Step 3: Add the Previous Submission Count Merge Tag

Now we’ll create the merge tag that counts previous submissions.

Use this merge tag:

{Email:1:gwp_count_matched_entries form_id="5" match_id="1"}

Here is what each part means:

Merge tag partMeaning
{Email:1}Uses the submitted value from the Email field. In our demo, Email is Field ID 1.
gwp_count_matched_entriesCounts entries that match the submitted value.
form_id="5"Searches entries from Form ID 5. In our demo, that is the Customer Request Form.
match_id="1"Looks for matching values in Field ID 1 of the target form, which is also the Email field.

In plain English, the merge tag says:

Take the email address submitted in this entry. Search Form 5 for entries where Field 1 has the same email address. Return the number of previous matching entries.

In our test, we submitted several entries using:

returning@example.com

The count increased like this:

Same-email submissionPrevious Submission Count result
1st submission0
2nd submission1
3rd submission2
4th submission3
5th submission4

This confirmed that the count worked for a returning-user workflow.

Gravity Forms entries showing previous submission count increasing for the same email address
In the demo, the previous submission count increased as the same email address was submitted again.

Step 4: Add the Total Submitted Value Merge Tag

Next, add a merge tag that calculates the total submitted value from matching entries.

Use this merge tag:

{Email:1:gwp_sum_matched_entries_values form_id="5" match_id="1" return_id="4" raw="true"}

Here is what each part means:

Merge tag partMeaning
{Email:1}Uses the submitted email address as the match value.
gwp_sum_matched_entries_valuesAdds up values from matching entries.
form_id="5"Searches entries from Form ID 5, the Customer Request Form in our demo.
match_id="1"Matches entries where Field ID 1 has the same email address.
return_id="4"Adds the value from Field ID 4, which is Request Value in our demo.
raw="true"Outputs the number without extra formatting.

In plain English, the merge tag says:

Take the submitted email address. Find matching entries in Form 5. For those matching entries, add the values from Field 4.

In our demo, the confirmation message showed a total matching submitted value of 2700 after multiple submissions used the same email address.

Your result will depend on the values submitted in your own form.

Step 5: Add the Merge Tags to the Confirmation Message

Now add the merge tags to your confirmation message.

Go to:

Form Settings → Confirmations → Default Confirmation

Set the confirmation type to Text.

Then paste this message:

Thanks for your request.
Here is the submission history we found for {Email:1}:
Previous submissions before this request:
{Email:1:gwp_count_matched_entries form_id="5" match_id="1"}
Total matching submitted value:
{Email:1:gwp_sum_matched_entries_values form_id="5" match_id="1" return_id="4" raw="true"}

Update the IDs to match your own form.

In our demo:

IDWhat it refers to
Form ID 5Customer Request Form
Field ID 1Email
Field ID 4Request Value

After submitting the form, the confirmation displays:

  • the email address used in the submission
  • the number of previous matching submissions
  • the total matching submitted value
Gravity Forms confirmation message using Advanced Merge Tags to show previous submissions and total submitted value
The confirmation message displays a previous submission count and total matching submitted value after the form is submitted.

Step 6: Test the Form with the Same Email Address

To test the setup, submit the form several times using the same email address.

For example:

SubmissionEmailRequest TypeRequest Value
1returning@example.comSupport100
2returning@example.comBilling200
3returning@example.comFeature Request300
4returning@example.comGeneral Inquiry400
5returning@example.comSupport500

Use the same email each time. The lookup depends on matching the submitted email value against entries that already use that same email.

If the setup is working, the count should increase as the same email is submitted again.

SubmissionExpected count
First submission0
Second submission1
Third submission2
Fourth submission3
Fifth submission4

If you test with different emails, the count will not increase because the entries do not match.

These are different values:

test1@example.com
test2@example.com
test3@example.com

Use one repeated email instead:

returning@example.com

Step 7: Check the Confirmation Result

After submitting the form, review the confirmation message.

In our demo, the confirmation showed:

  • previous submissions found for the submitted email
  • total matching submitted value

One tested confirmation result showed:

Previous submissions before this request:
7
Total matching submitted value:
2700

That means Advanced Merge Tags found earlier entries with the same email address and calculated the matching value total from the Request Value field.

Gravity Forms confirmation showing previous submission count and total matching submitted value
The confirmation message shows the submission history found for the entered email address.

Optional: Store the Results in Administrative Fields

The confirmation method is the easiest way to show the result.

But you can also store the resolved count or total inside the entry using administrative fields.

This is useful when site admins want to see the previous submission summary in the Entries screen.

For this optional method, create Administrative Single Line Text fields such as:

Field labelPurpose
Previous Submission CountStores the resolved count
Total Submitted ValueStores the resolved total

Then place the same merge tags in the fields’ default value settings.

You also need to enable this global Advanced Merge Tags setting:

Forms → Settings → Advanced Merge Tags → Replace field merge tags in Administrative Text fields

In our demo, the previous submission count worked in an administrative text field after this setting was enabled.

If you only need to show the result after submission, you can skip this optional section and use the confirmation method only.

Troubleshooting: What If the Output Does Not Work?

If the confirmation shows a blank result or the raw merge tag text, check these common issues.

Check the Form ID

The form_id must match the form you want to search.

In our demo, the Customer Request Form had Form ID 5:

form_id="5"

Your form may use a different ID.

Check the Email Field ID

The field ID inside {Email:1} and match_id="1" must match the Email field used for lookup.

In our demo, Email was Field ID 1.

If your Email field has a different ID, update both parts.

Check the Request Value Field ID

For the total submitted value, return_id must point to the numeric field you want to sum.

In our demo, Request Value was Field ID 4:

return_id="4"

Check the Advanced Merge Tags Access Settings

Go to:

Form Settings → Advanced Merge Tags

Use Specify per field, then allow access only to the fields needed for the lookup and calculation.

In our demo, those fields were:

  • Email
  • Request Type
  • Request Value

Test in the Confirmation First

For the easiest test, place the merge tags inside the confirmation message first.

Once the confirmation output works, you can move the same logic into an admin notification or administrative text field if needed.

Use a Repeated Email for Testing

The match only works when the same value is used again.

Use this:

returning@example.com

Do not use different test emails for each submission.

Privacy Notes Before Showing Previous Submission Data

Be careful when showing previous submission data to a front-end user.

In this demo, we only showed a count and a total value based on the submitted email address. We did not show private notes, full entry details, payment information, or personal data from other fields.

Before using this on a live site, ask:

  • Is this data safe to show to the person submitting the form?
  • Could someone type another person’s email and see information they should not see?
  • Should this summary be shown only to admins?
  • Should the result be stored in an admin-only field instead of shown in the confirmation?

For sensitive workflows, use the admin notification or administrative field approach instead of showing previous submission data in a public confirmation message.

Final Confirmation Message Used in This Demo

Here is the final confirmation message from the working demo:

Thanks for your request.
Here is the submission history we found for {Email:1}:
Previous submissions before this request:
{Email:1:gwp_count_matched_entries form_id="5" match_id="1"}
Total matching submitted value:
{Email:1:gwp_sum_matched_entries_values form_id="5" match_id="1" return_id="4" raw="true"}

Replace the IDs with your own form and field IDs.

Use this as the starting point, then test it with repeated submissions using the same email address.

Final Recommendation

Advanced Merge Tags can help you show useful Gravity Forms submission history without manually checking previous entries.

In this tutorial, we used a returning email address to:

  • count previous Gravity Forms submissions
  • calculate the total submitted value from matching entries
  • show the result in a confirmation message
  • optionally store the result in an administrative text field

For most use cases, start with the confirmation method. It is easier to test, easier to explain, and gives immediate context after the form is submitted.

For more advanced entry lookup workflows, review the official Advanced Merge Tags documentation and test each modifier in the exact context where you plan to use it.

Frequently Asked Questions

Can Gravity Forms show previous submissions?

Gravity Forms can show submitted values through merge tags. With GravityWP Advanced Merge Tags, you can extend that behavior by counting or calculating values from matching entries.

How can I count previous Gravity Forms submissions by email?

Use gwp_count_matched_entries with the submitted Email field as the match value. In this tutorial, the Email field was Field ID 1, and the merge tag counted entries from Form ID 5 where the Email field matched the submitted email.

Can I calculate the total value from previous Gravity Forms submissions?

Yes. Use gwp_sum_matched_entries_values to sum a numeric field from matching entries. In this demo, we summed the Request Value field from entries that matched the submitted email address.

Can I show the result in a confirmation message?

Yes. The working demo showed the previous submission count and total matching submitted value inside a Gravity Forms confirmation message.

Can I store the result inside the entry?

Yes. You can store resolved merge tag output in Administrative Text fields if the Advanced Merge Tags setting for replacing merge tags in Administrative Text fields is enabled. In this demo, the previous submission count worked in an administrative field.

Do I need custom code for this setup?

No custom PHP was used in this demo. The setup used Gravity Forms fields, confirmation text, and GravityWP Advanced Merge Tags.

Should I show previous submission data to users?

Only show data that is safe for the submitter to see. For sensitive workflows, send the summary to an admin notification or store it in an administrative field instead of showing it in a public confirmation message.

Proudly powered by WordPress