Writer Mode Specification

The Salesforce Writer allows the user to specify a writer mode, which determines what database command should be issued for each feature received. Valid writer modes are INSERT, UPDATE, UPSERT, DELETE, and HARDDELETE.

Writer Modes

In INSERT mode, the attribute values of each received feature that match a field in the destination Salesforce object schema are written as a new Salesforce record of that type. The ID field is ignored in this mode because IDs must be assigned by Salesforce.

In UPDATE mode, the attribute values of each received feature are used to update existing records on Salesforce. Incoming features must have an attribute that matches the ID field of the target Salesforce object. The records which are updated are determined by the ID field only: fme_where is not supported.

In UPSERT mode, records are updated or inserted based on the field specified in salesforce_external_id_field_name. Features to be written must have an attribute matching the external ID field name, and the attribute must have a value. The record on Salesforce will be updated if the external ID values match. Otherwise, the record will be created. Not all fields may be used as the external ID field name. Refer to Salesforce’s document on upserts at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert.htm for more information. The use of UPSERT is strongly encouraged to prevent the creation of unwanted duplicate records. To this end, UPSERT is the default writer mode. The ID field is ignored if it is not the field specified in salesforce_external_id_field_name.

In DELETE mode, existing database records are selected for deletion using the same technique as in UPDATE mode. Non-ID fields are ignored. Salesforce automatically cascades deletes.

In HARDDELETE mode, deletion skips Salesforce’s Recycling Bin, but is otherwise identical to the DELETE mode. This mode requires additional permissions on the Salesforce account.

Writer Mode Selection

The writer mode is specified at the feature type level only. The default mode is UPSERT. Specifying the writer mode on a per-feature basis using the fme_db_operation attribute is not supported.