Updating Salesforce records

Use the SalesforceRequest node to update records in the Salesforce system.

About this task

You can update Salesforce records by specifying Update in the Operation property of the SalesforceRequest node, and specifying the object type in the Salesforce object property. The object type can be overridden by the LocalEnvironment.Destination.Salesforce.Request.object environment variable.

The fields of the Salesforce record to be updated must appear in the input message tree as a JSON object. Fields that do not require updating do not have to appear in the tree.

If a Salesforce ID is specified in the LocalEnvironment.Destination.Salesforce.Request.Id environment variable, the record with that Salesforce ID value is updated.

If a Salesforce ID is not specified, and an external ID name and value are specified in the LocalEnvironment.Destination.Salesforce.Request.externalIdName and LocalEnvironment.Destination.Salesforce.Request.externalId environment variables, the record with that external ID is updated. If the record does not exist, it is created. If neither a Salesforce ID nor an external ID is specified in the local environment, but an Id element is found in the input message tree, that value is used as a Salesforce ID and the record with that Salesforce ID is updated.

When the record is updated, the input message tree is copied to the location specified by the Output data location property of the node, and augmented with the Salesforce ID in an Id element. The Salesforce Id is not provided in the Output tree if an external Id has been specified, unless a new Salesforce record is created (if it did not previously exist). If an external Id is specified but the Salesforce record cannot be found, the Salesforce record is created. This is called an upsert operation and occurs only if an external Id has been specified.

JSON schema are supplied for a wide range of Salesforce objects, and you can use them as input and output for message maps in a Mapping node. For example, you can create the message tree to update a Salesforce Account record in a Mapping node by using the JSON schema for the Account object. For more information, see Using Salesforce models.

Procedure

Follow these steps to update a Salesforce record of a specified type (for example, an Account object):

  1. Set up a Salesforce account on Salesforce.com.
  2. Configure a connection to Salesforce.com.
  3. Create a flow containing a SalesforceRequest node, and set the node properties:
    1. On the Basic tab, set the following properties:
      • In the Salesforce URL property, specify the URL of the external Salesforce system.
      • In the Operation property, specify Update.
      • In the Salesforce object property, select the type of Salesforce object that you want to update (for example, Account).
      • In the Security identity property, specify the security identity that you will use when connecting to the Salesforce system. For information about configuring the security identity on the integration node, see Configuring a secure connection to Salesforce.com.
      • In the Timeout property, specify the time (in milliseconds) that the node waits for Salesforce to process the operation.
    2. On the Request tab, set the Data location property to specify the location in the incoming message tree that contains the JSON objects data that will be used to update Salesforce.
    For more information, see SalesforceRequest node.
  4. Send the required message through the flow to the Salesforce system.
    You will receive a response from the Salesforce system to confirm that the records have been updated.
  5. Go to your Salesforce account to verify that the records have been updated correctly.