wpf_crm_object_type

#Overview

By default WP Fusion interfaces with Contacts in all of our supported CRM integrations. Some platforms like Salesforce, Ontraport, and Zoho support custom object types in addition to contacts (like Leads).

You can override WP Fusion to interface with a different object type via a filter in your functions.php file.

Changing the object type will also reset the fields available for syncing. After changing the object type, please reload the available fields by going to Settings » WP Fusion » Setup and clicking the blue Resync Available Tags & Fields button.

#Salesforce

For example, to interface with Salesforce’s “leads” component, you would use the following:

add_filter( 'wpf_crm_object_type', function( $object_type ) {
	return 'Lead';
});
Note: As of WP Fusion 3.41.6, it’s now possible to set the object type for Salesforce without a code snippet. The object type can be set from the Object Type dropdown on the Setup tab in the settings.

#Zoho

To interface with Zoho’s “leads” component, you would use the following:

add_filter( 'wpf_crm_object_type', function( $object_type ) {
	return 'Leads';
});

#Ontraport

Ontraport uses numeric IDs for object types. The default type is 0 for contacts. To override that, pass the ID of your custom object into the filter.

add_filter( 'wpf_crm_object_type', function( $object_type ) {
	return 8;
});

#Can WP Fusion interface with multiple object types at the same time?

The short answer is no.

That’s because WP Fusion syncs your WordPress users bidirectionally with the selected object type in your CRM.

That’s usually Contacts, but could also be Leads or a custom object type.

If you take a hypothetical scenario where WP Fusion is configured to sync with both Contacts and Leads at the same time:

  • A new Lead is created in Zoho CRM
  • A webhook syncs the Lead back to a new WordPress user account
  • The user updates their profile, which creates a Contact in Zoho
  • Now you have two duplicate records, one Lead and one Contact, both linked to the same WordPress user

Or

  • Email address is updated on [email protected]’s lead record
  • The changed email address is loaded to Jane’s WordPress user account
  • WP Fusion syncs the changed email address to Jane’s contact record

Obviously it doesn’t do any good to have two separate CRM objects that are kept in sync with eachother, since the records will be identical.

And it will slow down your WordPress site having WP Fusion constantly connecting to your CRM to sync the objects with eachother.

#Conditionally switching object types

An exception to that is switching the object type temporarily, just for certain operations.

For example maybe you have WP Fusion syncing your users bidirectionally with Contacts in your CRM, but you want all Gravity Form submissions to create a new Lead (with a one-way sync).

function my_gform_after_submission( $entry, $form ) {

	if ( ! function_exists( 'wp_fusion' ) ) {
		return false; // Make sure WP Fusion is running
	}

	// Gets the first name and last name from field ID 5, and email from field ID 6
	$contact_data = array(
		'FirstName' => rgar( $entry, '5.3' ),
		'LastName'  => rgar( $entry, '5.6' ),
		'Email'     => rgar( $entry, '6' ),
		'Company'   => 'CompanyName',
	);

	$lead_id = wp_fusion()->crm->add_object( $contact_data, 'Lead' );
}

// Replace "1" with the ID of the form
add_action( 'gform_after_submission_1', 'my_gform_after_submission', 10, 2 );

This example runs after a Gravity Form has been submitted and then creates a new lead with the submitted form data, using the add_object() method.

For another example with Salesforce, see this Gist:

#Alternatives

Implementing a custom object switching solution with WP Fusion is usually a complex project.

In some cases it’s better to use a different plugin for your custom objects, and let WP Fusion focus on the bi-directional sync of your user and customer data.

  • For creating or updating additional objects when Contacts are updated, we recommend using Salesforce Flows. See the tutorial here.
  • For syncing custom post types with Salesforce objects, we recommend Object Sync for Salesforce.
  • For syncing WooCommerce orders with Salesforce orders, we recommend WooCommerce Salesforce Integration by CRM Perks.
  • Gravity Forms Salesforce can be installed through the WordPress plugin directory. It is quite powerful, as it can send form submissions from your WordPress site to Salesforce as whatever object you need. It’s important to mention that this works for any form created with the Gravity Forms plugin. It’s also important to mention that this does not sync data back from Salesforce into WordPress.

Was this helpful?