Blog

Fixing The Gravity Forms Salesforce Add-On For WordPress

Salesforce is a very popular Customer Relationship Management (CRM) platform. It allows businesses to closely monitor the status of their customers and offers insights into help manage and boost sales and retention rates.

Naturally, there are ways connect the most popular content management system with one of the most popular CRM platforms. One popular method is using the free Gravity Forms Salesforce Add-on found in the WordPress.org plugin directory, which will enable form entries submitted via forms made with the excellent Gravity Forms plugin to be passed as a lead to the Salesforce system. This is made possible thanks to Salesforce’s API.

Salesforce announced they would deprecate the old API endpoint that handles Web-to-Case and Web-to-Lead functionality as of April 20, 2018. Unfortunately, the aforementioned Gravity Forms Salesforce Add-on hasn’t been updated since September 2015, and when this change came into affect, entries are no longer sent to the Salesforce system as it uses the wrong URL for the API.

However there is good news. As the plugin extensively uses the WordPress hook system, the API endpoint can be corrected without even editing the plugin. Simply copy the below code into your functions.php file or into a custom feature plugin and the Gravity Forms Salesforce Add-on will resume working correctly.


<?php
/**
* Updates the Salesforce API endpoint for the Gravity Forms Salesforce Add-On
* From the article Fixing The Gravity Forms Salesforce Add-On For WordPress: https://cameronjonesweb.com.au/blog/fixing-the-gravity-forms-salesforce-add-on-for-wordpress/
*
* @link https://help.salesforce.com/articleView?id=Updating-the-Web-to-Case-and-Web-to-Lead-Endpoint-URL&language=en_US&type=1
* @param string $sub The current subdomain (www or test).
* @param bool $test Whether it's in test mode or not.
* @return string The new subdomain
*/
function cameronjonesweb_salesforce_subdomain( $sub, $test ) {
if ( 'www' === $sub ) {
$sub = 'webto';
}
return $sub;
}
add_filter( 'gf_salesforce_request_subdomain', 'cameronjonesweb_salesforce_subdomain', 99, 2 );

Did you find this post useful?

YesNo