Hubspot Form Name Error [RESOLVED]

Hello,

I am currently trying to add in a new HubSpot feed with the HubSpot plugin for gravity forms. Gravity forms and the plugin are both up to date and I’ve used them on a previous site and they work perfectly.

The issue I am having is that when I got to create the feed to send the information into hubspot I get an error “There was an error while saving your settings. Could not add HubSpot form. Please try again later.” on the Hubspot form name field.

Has anyone experiences this before? I went and tried creating a new feed on an exiting website that is already working with the plugin and it gave me the same issue. The only thing that I could think has changed was we added 2FA to HubSpot but I didn’t think that would prevent gravity forms from sending information.

1 Like

I am having the same issue.

HubSpot have made a change to how they handle the lifecyclestage property which results in their API returning an error when trying to save or update the feed.

Until the product team can update the add-on to support this change you can use the following code snippet in the theme functions.php file or a custom functions/code snippets plugin to remove the lifecyclestage from the create/update form request that occurs on feed save.

add_filter( 'gform_hubspot_form_object_pre_save_feed', function( $hs_form, $feed_meta, $form ) {
    gf_hspot()->log_debug( current_filter() . ': running hotfix' );

    $hs_form['formFieldGroups'][0]['fields'] = array_values( array_filter( $hs_form['formFieldGroups'][0]['fields'], function( $fields ) {
        return $fields['name'] != 'lifecyclestage';
    } ) );

    return $hs_form;
}, 10, 3 );
2 Likes

This allowed me to save the form settings thank you very much. I assume we will just remove it when the update has been made.

Yes, when the issue is fixed in an add-on update the code snippet can be removed.

1 Like

A new build of the HubSpot Add-On is available on your Downloads page. Please download HubSpot v1.7.1 from here Log In ‹ Gravity Forms — WordPress

Upload this add-on via Plugins → Add New → ​​Upload Plugin. WordPress will show “This plugin is already installed.” Click the “Replace current with upload” button to overwrite the version you have installed with this new version.

After installing the plugin, please remove the snippet we provided earlier to work around this issue. If you have any trouble, please let us know.​​ Thank you.