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.

Creating an admin form for sending a message from an entry

  1. amydpnw
    Member

    I have a registration form that is allows for a multi day reservation (start to end date) and I would like to create an admin form that will scan the entries for anyone that is registered for the dates and the names from the entries will populate a drop down.

    First question is, is this even possible with GF (assuming I custom coded it) and of so, any ideas on how others would implement this?

    The reason I'm looking to GF is that the data is already there so if I can utilize it again, would love it.

    Posted 12 years ago on Monday January 23, 2012 | Permalink
  2. Hi, amydpnw,

    Yes, this is possible. You could use the gform_field_value_$parameter_name" hook (http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name). In that hook you can query the database to get the entry ids (lead_ids) for the records which match the time range you specify and populate a drop down with the data. The query would be something similar to:

    select lead1.lead_id
    from wp_rg_lead_detail lead1 join wp_rg_lead_detail lead2 on lead1.lead_id = lead2.lead_id and lead1.form_id=lead2.form_id
    where lead1.form_id=43 and lead1.field_number = 1 and lead1.value >= '2011-01-30'
    and lead2.field_number=2 and lead2.value <= '2012-02-09'

    Once you have the matching lead_ids, you can then query the data to get the first name/last name of the users belonging to those entries (lead_ids). You can use something like this:

    select lead1.lead_id, lead1.value as first_name, lead2.value as last_name
    from wp_rg_lead_detail lead1 join wp_rg_lead_detail lead2 on lead1.lead_id = lead2.lead_id
    where lead1.lead_id in (324,325) and (cast(lead1.field_number as decimal) = cast(3.3 as decimal) and cast(lead2.field_number as decimal) = cast(3.6 as decimal))

    You then use that data to populate the drop down.

    I hope this points you in the right direction.

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  3. amydpnw
    Member

    Dana - That helps a lot!! Thank you!!

    I'll post an update after I get this implemented.

    - Amy

    Posted 12 years ago on Monday February 6, 2012 | Permalink

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