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.

Update Entry field value by gform_after_submission hook

  1. tex77
    Member

    I'm having trouble using the gform_after_submission hook to set/update the value of a particular Field in the Entry just created. The field is just a simple Paragraph-Text field in my form, with visibility set to Admin-Only, and has Field ID of 13. I've tried things like:

    $entry_id = $entry["id"];
    RGFormsModel::update_lead_property($entry_id, $entry['13'], $myValue);

    and

    $entry["13"] = $myValue;
    RGFormsModel::update_lead($entry);

    and

    gform_update_meta($entry_id, $entry["13"], $myValue);

    Any help much appreciated!

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  2. tex77
    Member

    I'm starting to think that gform_update_meta is the right way, but I still can't get it working. How do i find the correct meta_key for my Field#13? The Label is "eCheck Transaction Info" (as displayed in admin-ui).

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  3. There is no hook or filter in Gravity Forms to allow you to go back and update an existing entry. We are discussing adding one in a future version because many people have wanted to do the same thing. You will have to go direct to the database and update the value in the existing entry there. Here is some code to do it: http://pastebin.com/8jzCnSpK

    You will have to modify some of the values there (for the form and field IDs) and also, the field needs to exist in your form already for this to work to store the value. You can make it a hidden field with no value and leave it as such at submission time, then go back and add your transaction info.

    Posted 7 years ago on Thursday February 14, 2013 | Permalink
  4. I'd like to add my +1 for this ability to be added natively, as this is very useful.

    I am using Gravity Forms for quote forms, and want to be able to go off and calculate the quote based on their input, then input that quote value to the Entry so that it all appears together in one place. It would be good if there was a native way to do this without having to edit the database.

    Posted 6 years ago on Tuesday May 14, 2013 | Permalink
  5. David Peralty
    Administrator

    Shaun, you can include Admin Only Fields where you can then add data to the entry as needed. Try it out. :)

    Posted 6 years ago on Tuesday May 14, 2013 | Permalink
  6. Hi David, you're misunderstanding, I need to first gather their data, then run some calculations, then add in the quote result to the entry. This needs to happen after they've submitted, so it's not as simple as Admin Only Fields.

    I've managed to work out how to do it by searching here and looking through the code, plus an addon called Gravity Forms Directory, but it should not need addons and extra work to do this.

    Posted 6 years ago on Tuesday May 14, 2013 | Permalink
  7. David Peralty
    Administrator

    Are the calculations manual? Can you not use our number field with calculations to come up with the quote price?

    As for not needing add-ons and extra work. Without add-ons and extra work, Gravity Forms would pretty much just be a simple HTML form replacement. The advantage is that it is customizable, flexible and extendable.

    Posted 6 years ago on Tuesday May 14, 2013 | Permalink
  8. Hi GF guys, I just wanted to add something to this. My case is slightly different but I'd be keen to see a solution in GF going forward.

    I'm hooking into the gform_after_update_entry action, and sending an email. Since I dont want to send this twice, I have a field with a true/false value to say whether it's already been sent. I'm trying to change the value of this field after admin update (and sending the email) to true, so I can tell if the email has already been sent.

    I guess the first part is; can I do that? Second is; if I can't, can I add my Plus 1 for the feature in the next update?!

    Thanks
    Andy

    Posted 6 years ago on Wednesday May 15, 2013 | Permalink
  9. Edh
    Member

    Is there a way to do this without going to straight SQL available now?

    I have a similar scenario as above where I need to update some customer-entered data and tracking fields based on some workflow that happens (well) after the initial form submission.

    Thanks!

    Posted 6 years ago on Sunday June 23, 2013 | Permalink