function salesforce_api_get_deleted in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_get_deleted()
Wrapper for SOAP SforceBaseClient::getDeleted. Searches for records deleted between start and end date.
Parameters
string $type: The name of the Salesforce object to retrieve data for.
int $start: The timestamp for the beginning of the query.
int $end: The timestamp for the end of the query.
Return value
FALSE if failed, or an object containing an array of Ids and the latest date covered. $response->deletedRecords = array of objects containing deletedDate and SFID $response->earliestDateAvailable = timestamp of the earliest available deleted object for the query $response->latestDateCovered = timestamp of latest deleted Salesforce object
File
- salesforce_api/
salesforce_api.module, line 1824 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_get_deleted($type, $start, $end) {
if (!$type || !$start || !$end) {
return FALSE;
}
$sf = salesforce_api_connect();
if ($sf) {
try {
$response = $sf->client
->getDeleted($type, $start, $end);
} catch (Exception $e) {
// Log the error message.
salesforce_api_log(SALESFORCE_LOG_SOME, 'Could not get deleted records from Salesforce: %message.', array(
'%message' => $e->faultstring,
'!debug' => check_plain($sf->client
->getLastRequest()),
), WATCHDOG_ERROR);
// Indicate the failed delete.
return FALSE;
}
if ($response->deletedRecords) {
return $response;
}
else {
return FALSE;
}
}
}