Salesforce Upsert All

The Salesforce Upsert All activity creates new objects or updates existing objects; uses a custom field to determine the presence of existing objects.

This activity uses the external ID to determine whether it creates a new object or updates an existing one:
  • If the external ID does not match, a new object is created.
  • If the external ID is matched once, the existing object is updated.
  • If the external ID is matched multiple times, an error is reported.
  • When batch updating multiple objects where the external ID is the same for two or more objects in your batch call, those records are marked as errors in UpsertResult. The objects are neither created nor updated.

General

In the General tab, you can establish a connection to the Salesforce.com server.

The following table lists the configurations in the General tab of the Salesforce Upsert All activity:

Field Module Property? Description
Name No The name displayed as the label of the activity in the process.
Salesforce Connection Yes The path to the Salesforce shared resource.

Click the Choose/Create Default Resource icon to select a usable connection for the activity.

Description

In the Description tab, you can enter a short description for the Salesforce Upsert All activity.

Input

In the Input tab, you can specify input values for the Salesforce Upsert All activity.

The following table lists the input elements in the Input tab of the Salesforce Upsert All activity:

Input Items Data Type Description
connectionInfo (All fields in this section are optional.)
serverUrl String The web address of the endpoint that is used by this operation.
sessionId String The unique ID associated with this session.
externalSessionIdUsed Boolean Specifies whether an external session ID is used (true) or not (false).

If the value is set to true, an external session ID is filled in the sessionId field.

In this case, when the session has to be refreshed, the refreshed operation cannot be performed, and an exception is thrown.

upsert
batchSize Integer Optional. When processing large amounts of data, the activity internally invokes several SOAP calls. This field is used to set the batch size for the number of records created or updated through an SOAP call.

The value must be set between 1 and 200. The default value is 200.

If the input value equals -1, it is set to the default value. If the input value is greater than 200, it is set to 200. If the input value is less than 1 (except -1), it is set to 1.

upsertSObjects Each upsertSObjects includes the following elements:
  • externalIDFieldName (A string value): required. This field contains the name of the field defined as a key field in the sObject.
  • sObjects (A complex value): required. An array of one or more objects to create or update. This sObject can be converted to the specified type defined in the metadata schema, for example, the Salesforce_metadata, retrieved from the Salesforce.com server.
    Note: You are not required to specify the Id field in the sObject.

    To create a new relationship between a newly created sObject (sObject A) and an existing sObject (sObject B), where the sObject A schema includes the sObject B schema, set the value of the key field in sObject B while upserting sObject A. If you modify the values of the fields in sObject B within the sObject A schema, the original sObject B is not modified. The key field in sObject B within the sObject A schema is only used to link sObject A with the original sObject B.

upsert_Optional (All fields in this section are optional.)
_configData Each _configData includes the following element:
  • timeout (An integer value): the timeout value specifies the number of milliseconds an internal API call waits before the data returns.

    The default value is 15000 milliseconds.

headers Each headers includes the following elements:
  • CallOptions
    • client (A string value): a string that identifies a particular client.
    • defaultNamespace (A string value): a string that identifies a developer namespace prefix. Use this field to resolve field names in managed packages without having to fully specify the fieldName everywhere.
  • AssignmentRuleHeader
    • assignmentRuleId (A string value): the ID of a specific assignment rule to run for the case or the lead. It can be an inactive assignment rule. The ID can be retrieved by querying an AssignmentRule object. If specified, do not specify useDefaultRule. This element is ignored for Accounts, because all territory assignment rules are applied.

      The case and the lead are two predefined Salesforce.com schema types. For more information about these two types, see Force.com Web Service API Developer's Guide.

    • useDefaultRule (A boolean value): if true for a case or a lead, uses the default (active) assignment rule for the case or the lead. If specified, do not specify an assignmentRuleId and type an empty string in the assignmentRuleId field. If true for an Account, all territory assignment rules are applied, and if false, no territory assignment rules are applied.
  • MruHeader
    • updateMru (A boolean value): specifies whether to update the list of most recently used items (true) or not (false), which is on the sidebar of the Salesforce.com user interface.
  • AllowFieldTruncationHeader
    • allowFieldTruncation (A boolean value): specifies whether to truncate field values that are too long (true) or not (false).

      Default value is false: no change in behavior. If a string or text area value is too large, the operation fails and the fault code STRING_TOO_LONG is returned.

  • DisableFeedTrackingHeader
    • disableFeedTracking (A boolean value): if disableFeedTracking is set to true, the changes made in the current call are not tracked in feeds.

      The default is false.

  • StreamingEnabledHeader
    • streamingEnabled (A boolean value): specifies whether you want to receive streaming notifications for changes to Salesforce data.
  • AllOrNoneHeader
    • allOrNone (A boolean value): if allOrNone is set to true, any failed records in a call cause all changes for the call to be rolled back. Record changes are not committed unless all records are processed successfully.

      The default value is false. Some records can be processed successfully while others are marked as failed in the call results.

      Note: When processing large amounts of data, the activity internally invokes several SOAP calls.

      However, this AllOrNoneHeader applies to each internal SOAP call individually. If allOrNone is set to true, only individual internal SOAP calls with failed records are rolled back. All the record changes of other calls are committed.

  • DuplicateRuleHeader
    • allowSave (A boolean value): if allowSave is set to true, duplicate records are saved. If this value is set to false duplicate records are prevented from being saved.
    • includeRecordDetails (A boolean value): if includeRecordDetails is set to true, fields and values for records detected as duplicates are retrieved. If this value is set to false, only record IDs for records detected as duplicates are retrieved.
    • runAsCurrentUser (A boolean value): if runAsCurrentUser is set to true, sharing rules for the current user are enforced when duplicate rules run. If this value is set to false, sharing rules specified in the class for the request are used.
      Note: If no sharing rules are specified, Apex code runs in system context and sharing rules for the current user are not enforced.
  • LocaleOptions
    • language (A string value): specifies the language of the labels returned. The value must be a valid user locale (language and country), such as de_DE or en_GB. For more information about the locales, see Force.com Web Service API Developer's Guide.
  • DebuggingHeader
    • debugLevel (A string value): specifies the level of detail in the debug header. See Salesforce.com document Apex Developer’s Guide for detailed information.

      The response of the debugging information can be found in the SOAP message log. To trace the debugging errors, the debug role log might be required.

  • PackageVersionHeader
    Each PackageVersion includes the following nodes:
    • majorNumber (An integer value): the major version number of a package version.

      A package version is denoted by majorNumber.minorNumber, for example 2.1.

    • minorNumber (An integer value): the minor version number of a package version.

      A package version is denoted by majorNumber.minorNumber, for example 2.1.

    • namespace (A sting value): the unique namespace of the managed package.
  • EmailHeader
    • triggerAutoResponseEmail (A boolean value): specifies whether to trigger auto-response rules (true) or not (false), for leads and cases. In the Salesforce.com user interface, this email can be automatically triggered by a number of events, for example, resetting a user password.
    • triggerOtherEmail (A boolean value): specifies whether to trigger email outside the organization (true) or not (false). In the Salesforce.com user interface, this email can be automatically triggered by creating, editing, or deleting a contact of a case.
    • triggerUserEmail (A boolean value): specifies whether to trigger email that is sent to users in the organization (true) or not (false). In the Salesforce user interface, this email can be automatically triggered by a number of events: resetting a password, creating a new user, adding comments to a case, or creating or modifying a task.
  • OwnerChangeOptions

    Each OwnerChangeOption includes the following elements:

    • type (A string value): represents the action performed or skipped, according to the given value for the execute field, when changing a record owner during an upsert call.
    • execute (A boolean value): if it is set to true, the action represented by the type field is performed. If false, the action represented by the type field is skipped.

      The default is false.

Output

In the Output tab, you can find the output value.

The following table lists the output elements in the Output tab of the Salesforce Upsert All activity:

Output Item Data Type Description
upsertAllResponse
result created Boolean Indicates whether the record is created (true) or updated (false).
errors Complex If errors occur during the activity, an array of error objects with the error code and description, is returned.
id String The ID of an sObject that you attempt to create.
success Boolean Indicates whether the Salesforce Create All activity has succeeded (true) or not (false).

Fault

In the Fault tab, you can find the error code and error message of the Salesforce Upsert All activity. See TIBCO ActiveMatrix BusinessWorks Error Code for more information about error codes and corrective actions to take.

Fault Thrown when
SalesforceExecuteSOAPMethodException An error occurred when calling an SOAP method.

For example, wrong values are set in the Input fields or the Salesforce session has timed out.

SalesforceLoginException An error occurred when logging in to the Salesforce.com server.
SalesforceConnectionNotFoundException An error occurred when the external session ID is not used or the Salesforce connection is not configured correctly.