0

I am working with Gravity Forms. This code works with a couple issues :

add_action('gform_after_submission_14', 'post_contract_update', 10, 2);
function post_contract_update($entry, $form) {
    $form ='3';
    $lead = $entry['4'];
    $statusvalue_update = 'Under Contract';
    GFFormsModel::update_lead_field_value($form, $lead, '', '', 154, $statusvalue_update);
}

After form 14 is fired, it does what it is supposed to using Gravity Forms Model : update_lead_field_value.

Only problem is - once my $lead (lead_id) goes over 9, to a double digit, the entry gets truncated. So for example, in this image below, I actually put in 448 into $lead. In the DB it's only showing as 4.

Gravity forms sql shown

The storage field is correct int 10 - and adding directly via sql works. So far I have -

  • added directly via PHP
  • move firing of the function around
  • changed priority
  • changed themes just in case
  • deactivated plugins just in case
  • single qouting, double qouting
  • printed out array - everything looks perfect
  • change string to intval etc...

Nothing seems to work, no matter what - once my $lead id goes above a single digit.

Am I missing something incredibly easy? Am I unaware of limitations on GFFormsModel::update_lead_field_value? Is the model expecting some specific number format?

0

Going to close this and answer myself.

Apparently, there is something wrong with the way that GFFormsModel::update_lead_field_value truncates fields. I was unable to get this to work.

Instead - I opted to use a direct WP insert (with if elseif etc...) - like so :

$csql = $wpdb->insert("wp_rg_lead_detail", array("id" => NULL,"lead_id" => $lead,"form_id" => $form,"field_number" => "154","value" => 'value'));

Not what I wanted to do, but hopefully this will save anyone some time and effort if they run into the same issue with this model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.