function salesforce_api_retrieve in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_retrieve()
Wraps SforceBaseClient::retrieve. Retrieve an object from Salesforce with standard fields and any data in fields defined in the name object.
Parameters
$ids: An array of Salesforce IDs for the objects to retrieve.
$name: The name of the fieldmap that contains the fields to retrieve.
Return value
The single matching Salesforce objects or an array of all the objects if more than one are returned.
2 calls to salesforce_api_retrieve()
- sf_entity_import in sf_entity/
sf_entity.module - Imports data from Salesforce into a Drupal entity
- sf_entity_salesforce_form in sf_entity/
sf_entity.module - Displays the Salesforce synchronization form.
File
- salesforce_api/
salesforce_api.module, line 1747 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_retrieve($ids, $name) {
$sf = salesforce_api_connect();
if (!$sf) {
// Let modules react to a failure to export this node.
module_invoke_all('salesforce_api_export_connect_fail', NULL, $name, $ids);
if (user_access('administer salesforce')) {
drupal_set_message(t('Unable to connect to Salesforce using <a href="!url">current credentials</a>.', array(
'!url' => url(SALESFORCE_PATH_ADMIN),
)));
}
return FALSE;
}
// Load the fieldmap so we can get the object name.
$map = salesforce_api_salesforce_fieldmap_load($name);
$object = salesforce_api_fieldmap_objects_load('salesforce', 'salesforce', $map->salesforce);
$fields = array_keys($object['fields']);
return $sf->client
->retrieve(implode(', ', $fields), $map->salesforce, $ids);
}