Hello,
I’m working with Object Sync for Salesforce plugin with my Sage 9 instance and I’m attempting to utilize this hook:
function find_sf_object_match( $salesforce_id, $wordpress_object, $mapping = array(), $action ) {
if ( $action === 'push' && $mapping['wordpress_object'] === 'user' ) {
if ( is_object( $this->salesforce ) ) {
$salesforce_api = $this->salesforce->salesforce['sfapi'];
} else {
$salesforce = $this->salesforce();
$salesforce_api = $salesforce->salesforce['sfapi'];
}
if ( is_object( $salesforce_api ) ) {
// we want to see if the user's email address exists as a primary on any contact and use that contact if so
$mail = $wordpress_object['user_email'];
$query = "SELECT Primary_Contact__c FROM Email__c WHERE Email_Address__c = '$mail'";
$result = $salesforce_api->query( $query );
if ( $result['data']['totalSize'] === 1 ) {
$salesforce_id = $result['data']['records'][0]['Primary_Contact__c'];
}
}
}
return $salesforce_id;
}
add_filter( 'object_sync_for_salesforce_find_sf_object_match', 'find_sf_object_match', 10, 4 );
This currently results in the following error:
**Fatal error** : Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\View\Engines\CompilerEngine::salesforce()
I assume this is some sort of namespace issue, can anyone shed some light on how I might resolve this?
Many thanks,
Dan