Advertising sustains the DA. Ads are hidden for members. Join today

About Field Mappings

Last updated on
30 April 2025

Much can be achieved through configuration alone. While mapping allows only 1 node to 1 salesforce object, setting it up is the key to all one- and two-way communication between Drupal and SFDC.

Consider sharing a node with title, body, and a description text field. If you like upserts to send all fields to Salesforce.com but want remote changes in SFDC to only change, say, the description field locally back at your Drupal site, multiple field mappings can be configured and selected where appropriate! Here is an example with sf_notifications handling inbound field mappings that affect only two cck "status" and "message" fields:
screenshot showing sf_notifications field mapping selector

Notice in this detail of that field mapping that only two of the many Drupal node and cck fields are selectively mapped:
screenshot of salesforce node and cck field mapping

Not shown here is the other field mapping ("Amendment field mapping"). It contains all the important upstream "source" data as the payload to the SFDC upsert.

Multiple field mappings on a content type/node

It appears that the first field mapping created (and inserted into the db) wins when it comes to which fields are mapped for node_save automatic sync. See:

/**
 * Loads the Salesforce ID and fieldmap index of a Drupal object.
 *
 * @param $type
 *   The type of the Drupal object you are requesting data for; node or user.
 * @param $id
 *   The associated unique ID used to identify the object in Drupal.
 * @return
 *   An array containing the associated Salesforce object type and ID or an
 *     empty array if no data was found.
 */
function salesforce_api_id_load($type, $id) {
  // Query the main ID table for the associated data.
  $result = db_query("SELECT sfid, name FROM {salesforce_object_map} WHERE drupal_type = '%s' AND oid = %d", $type, $id);

  // Return an empty array if no data was found.
  if (!$data = db_fetch_object($result)) {
    return (object)array('sfid' => NULL, 'name' => NULL);
  }
  else {
    // Otherwise return the Salesforce object type and ID.
    return $data;
  }
} 

called by sf_node.module:sf_module_nodeapi $op == 'load'.

This appears to be the expected, default behavior. So plan your multiple mapping options accordingly :)

Help improve this page

Page status: Not set

You can: