function salesforce_api_delete_salesforce_objects in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_delete_salesforce_objects()
Wrapper for SFBaseClient::delete
Parameters
string $sfid a Salesforce ID:
1 call to salesforce_api_delete_salesforce_objects()
- sf_entity_entity_delete in sf_entity/
sf_entity.module - Implements hook_entity_delete(). This should be sufficient for implementing node and user deletion as well.
File
- salesforce_api/
salesforce_api.module, line 1461 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_delete_salesforce_objects($sfids) {
if (empty($sfids)) {
return;
}
if (is_string($sfids)) {
$sfids = array(
$sfids,
);
}
$real_sfids = array();
foreach ($sfids as $i => $sfid) {
if (is_sfid($sfid)) {
$real_sfids[$i] = $sfid;
}
}
if (empty($real_sfids)) {
return FALSE;
}
try {
$sf = salesforce_api_connect();
if (!$sf) {
throw new Exception('Unable to connect to Salesforce');
}
return $sf->client
->delete($real_sfids);
} catch (Exception $e) {
salesforce_api_log(SALESFORCE_LOG_SOME, 'Failed to delete Salesforce objects with ids %s : %s.', array(
implode(', ', $real_sfids),
$e
->getMessage(),
), WATCHDOG_ERROR);
return FALSE;
}
}