function sf_prematch_sf_find_match in Salesforce Suite 7
Same name and namespace in other branches
- 6.2 sf_prematch/sf_prematch.module \sf_prematch_sf_find_match()
- 7.2 sf_prematch/sf_prematch.module \sf_prematch_sf_find_match()
Implement hook_sf_find_match
Parameters
string $action:
stdClass $object:
array $map:
File
- sf_prematch/
sf_prematch.module, line 134 - Extends Salesforce API module so checks for an existing match for an object before creating a new one.
Code
function sf_prematch_sf_find_match($action, $object, $map) {
$fieldmap = $map['fieldmap'];
$match_by = sf_prematch_match_by_load($fieldmap);
if ($match_by['primary_field'] == '') {
return;
}
require_once drupal_get_path('module', 'sf_prematch') . '/sf_prematch.main.inc';
$map = salesforce_api_fieldmap_load($map);
switch ($action) {
case 'export':
$result = sf_prematch_export($object, $map, $match_by);
break;
case 'import':
$result = sf_prematch_import($object, $map, $match_by);
break;
default:
$result = null;
break;
}
return $result;
}