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.

Dynamic Population Notification Strategy ???

  1. muhromatic
    Member

    Hello:

    Here is my Dilemma...

    I am creating a survey "form" for my members to allow their customers to fill out. When completed, I want the form to be automatically sent to my member's email via the notification system.

    Solution 1 was to create a new wp page and duplicate form for each member… then to use a pre-populated hidden field containing their email address to use for the notification routing. ( This creates lots of pages, lots of forms and complete HELL when it comes to modifying the survey)

    Solution 2 was to create one form and a unique wp page for each member... then to use the SHORT CODE approach to insert the member email address into the hidden field to use for notification routing. ( This still creates lots of wp pages and a lot of manual input of the short code variable )

    Solution 3 was to create one form and one wp page... then to use the QUERY STRING approach to insert the member email address into the hidden field to use for notification routing. ( This works in theory… but, the @ sign keeps being removed randomly by the browser/wordpress ???)

    So, is there any way to store the email addresses in gravity forms (or elsewhere)… and use a different QUERY STRING (accountID) that will dynamically pull the email address from storage/list?)

    Any help is appreciated…

    Thanks, Glenn

    Posted 12 years ago on Friday August 26, 2011 | Permalink
  2. Yes, option 3. Create one form. Create one page. Each of your members will have a different accountID to append to their link to the form, the link they will send their customers ( http://example.com/survey-2011/?accountID=12345678 ). Then, in your form, you have a hidden field that is set to be populated dynamically, the parameter name is accountID as you have typed above. I think I would have a default value for that field as well, in case someone gets smart and strips off the accountID from their link because they don't "want to be tracked" or something. With a default account ID in there (11111111 or something) you can ensure the email is delivered (maybe to you?) even though it will not work as intended for the member.

    In the admin notification, use "Routing" and then do some conditionals like

    if accountID = 12345678 then send email to chris@rocketgenius.com
    if accountID = 87654321 then send email to carl@rocketgenius.com
    ... for all your member accountID
    and finally do
    if accountID = 11111111 then send email to youremail@yourdomain.com

    It's certainly doable this way and is the preferred way of doing it, so you don't expose the email addresses. This is a high level overview of how to accomplish it, but I think once you start looking at it it will make sense.

    Posted 12 years ago on Saturday August 27, 2011 | Permalink
  3. muhromatic
    Member

    Chris...

    So, is there a problem having 100,000 routing conditionals? OUCH... :o)

    would love to just be able to update a table... with search functions etc...

    Thanks, Glenn

    Posted 12 years ago on Saturday August 27, 2011 | Permalink
  4. Please share more information. You didn't mention 100,000 members. Managing 100,000 conditionals would not work very well with AJAX in a browser.

    Now that we know it CAN be done, it's up to you to decide how to do it. You're going to have to use a hook (probably gform_notification_email to change the notification email address based on the value of the query string parameter accountID. That hook has access to the $FORM object so you can get the value of accountID. Then you just need to match that accountID with the email address. Maybe you have that stored in a MySQL database table somewhere, or a text file. You will need to write some code to return the proper email based on the value of accountID. It's all very doable with a bit of custom code.

    http://www.gravityhelp.com/documentation/page/Gform_notification_email

    Posted 12 years ago on Saturday August 27, 2011 | Permalink
  5. muhromatic
    Member

    Chris:
    Cool... but... my programing skills are non-existent.

    I can create the "accountID" field and I can setup it's dynamic population via a QUERY STRING.

    then I veer off into the weeds... @#$%^&^ ... and CRASH/BURN...

    Question, could the email be pulled from and existing table that already contains both the email and accountID?

    I use Digital Access Pass (DAP) ...

    I guess I am asking for help with the "hook" code to make this happen...

    Are we talking about a complicated implementation or a few lines of code?

    Any help/guidance would be appreciated.

    Also, I had posted this in a developers support ticket last night... Can you update that ticket with the above progress so as not to waste someones time walking me through the above.

    Thanks for your time,
    Glenn

    Posted 12 years ago on Saturday August 27, 2011 | Permalink
  6. Question, could the email be pulled from and existing table that already contains both the email and accountID?

    Yes

    And not a complicated implementation, but more than just a couple lines of code. (Not 50 though.) I think you will hook your function to the gform_notification_email hook. In your function you will read the parameter accountID from the query string, then pull the email associated with that from your database, and populate the notification email with that address. In your function you can deal with what happens when there is no match.

    It will not be too hard for someone familiar with Gravity Forms. You can find a current list of developers familiar with Gravity Forms here:

    http://www.gravityhelp.com/forums/topic/help-customizing-gravity-form-image-upload-functionality#post-32767

    Posted 12 years ago on Sunday August 28, 2011 | Permalink
  7. muhromatic
    Member

    So, now that hurricane Irene is out of the way... I have some time to try an get this working...

    Any help with the code to get me started would be very much appreciated.

    I would like to be able to dynamically populate an "email field" from an existing sql table using the QUERY STRING to dynamically populate the "memberid field" which will be used to identify the proper row in the existing sql table. if that makes any sense at all...

    I understand the logic involved but I am clueless with the code...

    Thanks, Glenn

    Posted 12 years ago on Monday August 29, 2011 | Permalink
  8. Glenn, please send me an email at chris@rocketgenius.com that contains a couple email addresses you own, so I can use those in the dynamic population and you can see it working. Otherwise, you'd submit my form and I would be getting all the notifications :-) Thanks.

    Posted 12 years ago on Monday August 29, 2011 | Permalink
  9. Thanks for the email addresses.

    Here is a sample form:
    http://gravity.chrishajer.com/customer-survey/

    Try submitting without an accountID and the results will be sent to the address that is set in the admin notification area (currently me.)

    Try submitting each of these:
    http://gravity.chrishajer.com/customer-survey/?accountID=123456789
    http://gravity.chrishajer.com/customer-survey/?accountID=abc123
    http://gravity.chrishajer.com/customer-survey/?accountID=555-1212

    The 123456789 will be sent to mac and the abc123 will be sent to the other. 555-1212 will fall back to the notification email in the admin settings. If no accountID is sent or the accountID is not found in the database, the email address from the admin notification settings will be used.

    You need to have a hidden field in your form with the "populate dynamically" box checked and the parameter name of "accountID" (case sensitive.)

    Here's the code http://pastebin.com/Rws5p0T5

    You will have to change the database connection details including the table name. You will have to change the form number (28 in my case) to your actual form number, and the $lead[4] to the actual field from your $lead (mine was form field #4). You will also have to change the field names in line 27 to your field names (the one that holds the accountID and the one that holds the email.)

    That should cover it. You might have some submission notifications from me already. After you check it out, I will change the email addresses so you don't continue to get notification of form submissions.

    Please ask if you need any additional help.

    Posted 12 years ago on Monday August 29, 2011 | Permalink
  10. muhromatic
    Member

    WOW... Unbelievable... Thank you so much...

    One "stupid" question... Exactly where do I drop this code once I modify it?

    Once again, Thanks a lot...

    Posted 12 years ago on Monday August 29, 2011 | Permalink
  11. muhromatic
    Member

    Chris:

    It is all up and running... THANK YOU...

    I have always said that you guys rock... But...

    "Gravity Forms has the best support team in the industry. Period."

    Thanks Again, Glenn

    Posted 12 years ago on Tuesday August 30, 2011 | Permalink
  12. Glad you figured it out. For the benefit of anyone following along, that code goes in functions.php in your theme:

    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    p.s. I changed the email addresses so you won't receive any submission notifications.

    Posted 12 years ago on Tuesday August 30, 2011 | Permalink

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