function hook_salesforce_pull_entity_presave in Salesforce Suite 7.3
Same name and namespace in other branches
- 8.4 salesforce.api.php \hook_salesforce_pull_entity_presave()
- 8.3 salesforce.api.php \hook_salesforce_pull_entity_presave()
- 5.0.x salesforce.api.php \hook_salesforce_pull_entity_presave()
Act on an entity just before it is saved by a salesforce pull operation. Implementations should throw a SalesforcePullException to prevent the pull.
Parameters
$entity: The Drupal entity object.
array $sf_object: The Salesforce query result array.
SalesforceMapping $sf_mapping: The Salesforce Mapping being used to pull this record
Throws
Related topics
1 invocation of hook_salesforce_pull_entity_presave()
- salesforce_pull_process_updated_records in modules/
salesforce_pull/ salesforce_pull.module - Process records in the queue.
File
- ./
salesforce.api.php, line 321 - These are the hooks that are invoked by the Salesforce core.
Code
function hook_salesforce_pull_entity_presave($entity, $sf_object, $sf_mapping) {
if (!some_entity_validation_mechanism($entity)) {
throw new SalesforcePullException('Refused to pull invalid entity.');
}
// Set a fictional property using a fictional Salesforce result object.
$entity->example_property = $sf_object['Lookup__r']['Data__c'];
}