Upsert Record Action

Estimated reading: 2 minutes 5 views

The Upsert Record action allows you to create or update a record dynamically in the Salesforce database. This action ensures data integrity by either inserting a new record or updating an existing one based on a unique key.

Upsert record action detail

Key Features

  • Combines Insert and Update functionalities.
  • Ensures data integrity by preventing duplicate records.
  • Allows specifying additional input parameters for field values.

Configuring an Upsert Record Action

When adding an Upsert Record action, the following fields must be configured:

1. Common Properties

  • Label:
    • A user-friendly name for the action, displayed in the process flow.
    • Required field.
  • Name:
    • A unique identifier for the action, used internally.
    • Required field.

2. Inputs

The inputs section defines the parameters required to perform the upsert operation. The following fields are available:

Required Fields

  1. Unique Key:

    • Specifies the unique field used to identify whether to update an existing record or insert a new one.
    • Examples: ExternalId__c, Email.
  2. SObject API Name:

    • Specifies the Salesforce object where the record will be created or updated.
    • Examples: Account, Contact, CustomObject__c.

Additional Inputs

  • You can define additional field values for the record being created or updated:
    • Name: API name of the field (e.g., Name, BillingCity, CustomField__c).
    • Type: Data type of the field (e.g., String, Number, Boolean).
    • Value: Value to assign to the field.

Example:

Field Name Type Value Comment
fields.Name String Acme Corp Sets the name of the record to “Acme Corp”.
fields.BillingCity String Los Angeles Sets the billing city to “Los Angeles”.
fields.CustomField__c Boolean true Updates a custom boolean field to true.

Usage Example

Scenario: Upserting Contact Records

  1. Unique Key: Email.
  2. SObject API Name: Contact.
  3. Additional Inputs:
    • fields.FirstName: John.
    • fields.LastName: Doe.
    • fields.Phone: 123-456-7890.
    • fields.Email: john.doe@example.com.

Steps:

  1. Add an Upsert Record action to the process.
  2. Fill in the Label and Name fields.
  3. Specify the Unique Key (Email) to identify records.
  4. Define the SObject API Name (Contact) for the object being upserted.
  5. Add additional inputs to populate fields like FirstName, LastName, and Email.
  6. Save the configuration and test the process.

Best Practices

  • Always validate the unique key field to ensure it is indexed for faster lookup.
  • Ensure the Salesforce object and fields exist before using them in the action.
  • Use sandbox environments for testing complex upsert operations.
  • Leverage outputs to dynamically reference the created or updated record in subsequent steps.

Leave a Comment

       
Euphoria, forever till the end of times

Euphoria

Share this Doc

Upsert Record Action

Or copy link

CONTENTS