PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Get entry ID in gform_pre_submission_filter function

  1. Hi.
    I am using the gform_pre_submission_filter function to filter the notification sent out. However, I would really like to be able to get the Entry ID (entry_id), as this is used as an order number and it needs to show in the email.
    Is it possible to get the entry ID in this function?
    Thank you.
    Vayu

    Posted 13 years ago on Thursday August 18, 2011 | Permalink
  2. The entry doesn't exist yet when the gform_pre_submission_filter hook is fired. That hook fires after validation but before the entry is created. So there isn't an Entry ID yet. You'd have to use the gform_post_submission hook which fires after the entry exists. Although that fires after the notification is sent out.

    Posted 13 years ago on Thursday August 18, 2011 | Permalink
  3. Hi Carl.

    Thank you for your feedback. :-)
    I did find a way to get the entry_id in the gform_pre_submission_filter hook, but it's a bit complicated. Here's what I did.
    I placed the {entry_id} in the message textarea in the "Notification to admin" section. I then called the content from the gform_pre_submission_filter hook like this:

    $form['notification']['message'] = $form['notification']['message'] .' '. $email_body';

    Where $email_body contains all my modified content and $form['notification']['message'] gets the entry_id.
    This is why I actually thought that the gform_pre_submission_filter hook was called after the data was stored in the db.
    Vayu

    Posted 13 years ago on Friday August 19, 2011 | Permalink

This topic has been resolved and has been closed to new replies.