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';
});

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.

Was this helpful?