You are here

function salesforce_api_fieldmap_clone in Salesforce Suite 7

Same name and namespace in other branches
  1. 5.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_clone()
  2. 6.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_clone()
  3. 7.2 salesforce_api/salesforce_api.module \salesforce_api_fieldmap_clone()

Clones a fieldmap.

Parameters

$fieldmap: The index of the fieldmap to clone.

Return value

The newly created fieldmap or FALSE if the clone failed.

File

salesforce_api/salesforce_api.module, line 462
Defines an API that enables modules to interact with the Salesforce server.

Code

function salesforce_api_fieldmap_clone($fieldmap) {

  // Load the fieldmap from the database.
  $map = salesforce_api_fieldmap_load($fieldmap);

  // Return FALSE if the source fieldmap does not exist.
  if (empty($map)) {
    return FALSE;
  }

  // Save the old fieldmap id, save a new one, and return the new one.
  unset($map['fieldmap']);
  salesforce_api_fieldmap_save($map);
  return !empty($map['fieldmap']) ? $map : FALSE;
}