Skip to main content

Salesforce Delete by Query

Overview

This documentation provides detailed information about the "Salesforce Delete by Query" connector, which facilitates the deletion of records from Salesforce based on a records from Source Entity.

Salesforce

Salesforce is a cloud-based customer relationship management (CRM) platform that provides a suite of applications for sales, customer service, marketing, and more. Salesforce allows businesses to manage customer interactions, track leads, and automate various processes to improve productivity and customer satisfaction.

Pre-Requisites

Before you can create a pipeline to import records from Salesforce, you need to have the following:

  • Salesforce account with API access
  • Salesforce Consumer Key and Consumer Secret for authentication
  • User Security Token (for password-based authentication)

How to Obtain Salesforce Consumer Key and Consumer Secret

  1. Log in to your Salesforce account.

  2. Open Setup page by clicking on the gear icon in the top right corner. salesforce setup button

  3. Enable "Authorization Code and Credentials Flows" in Settins/Identity/OAuth and OpenID Connect Settings. enable credentials flow

  4. Navigate to the "App Manager" page by typing "App Manager" in the Quick Find box and selecting "App Manager". salesforce app manager

  5. Create new connected app, and complete its basic information.

  6. In "API (Enable OAuth Settings)" check the "Enable OAuth Settings" checkbox

    1. In "Callback URL" enter https://login.salesforce.com/services/oauth2/callback
    2. In "Selected OAuth Scopes" add the following scopes:
      • Access Lightning Experience applications (lightning)
    3. Check "Enable Client Credentials Flow" checkbox.
    4. Save your changes.
  7. Select an execution user for the flow. Although there’s no user interaction in the client credentials flow, Salesforce still requires you to specify an execution user. By selecting an execution user, you allow Salesforce to return access tokens on behalf of this user.

    1. From the connected app detail page, click Manage.
    2. Click Edit Policies.
    3. Under Client Credentials Flow, for Run As, click Magnifying glass icon, and find the user that you want to assign the client credentials flow.
    4. For Enterprise Edition orgs, we recommend that you select an execution user who has the API Only User permission.
    5. Save your changes.
  8. Obtain the Consumer Key and Consumer Secret from the connected app detail page.

    1. Find your connected app, click Action dropdown, and then select View.
    2. Click "Manage Consumer Details" button.
    3. Salesforce will require you to enter key from email, and then you will be able to see the Consumer Key and Consumer Secret.
    4. Save the Consumer Key and Consumer Secret for use in the connector.

How to Obtain Salesforce User Security Token

  1. Log in to your Salesforce account.
  2. Click on your profile icon and select "Settings".
  3. In the left sidebar, open "My Personal Information" panel and then click on "Reset My Security Token".
  4. Click on the "Reset Security Token" button.
  5. Salesforce will send an email to your registered email address with the security token.
  6. Use the security token along with your password for authentication in the connector. Example: mypassword1j7Xk8JFPdxVBDo6CL1BWUAk4

Connector Parameters

Salesforce Settings

This group contains settings specific to your Salesforce instance and the resources you intend to access

Salesforce Base URL

The base URL of your Salesforce instance. Example: https://login.salesforce.com for production salesforce instance or https://test.salesforce.com for test instance.

Salesforce Object

The Salesforce object from which you want to import records. Example: Account You can find the list of available objects in your Salesforce instance by navigating to Setup > Object Manager.

Salesforce Auth Settings

Configuration settings for authenticating with Salesforce, ensuring secure access to your data.

Salesforce Username

The username of the Salesforce account you want to use for authentication.

Salesforce Password

The password + security token of the Salesforce account you want to use for authentication. Example mypassword1j7Xk8JFPdxVBDo6CL1BWUAk4

Salesforce Consumer Key

The Consumer Key of the connected app you created in Salesforce.

Salesforce Consumer Secret

The Consumer Secret of the connected app you created in Salesforce.

Source Entity Settings

Settings for the source entity from which data is pulled before being upserted into Salesforce.

Source Entity

The entity from which data will be pulled for deleting into Salesforce.

Source Entity Only Updated

Indicates if only updated records should be considered.

Source Entity Filter

Criteria for selecting records from the source entity.

Source to Salesforce Mapping

Mapping of source entity fields to Salesforce fields. This mapping determines how data from the source entity is transformed and stored in Salesforce. Example:

{
"Salesforce_field_1": "$.data.source_field_1",
"Salesforce_field_2": "$.data.source_field_2",
"Salesforce_field_3": "$.data.source_field_3",
"Salesforce_external_id": "$.data.source_id"
}



## Pipeline Creation Process
Follow these steps to create a pipeline for importing records from Salesforce:

1. **Obtain Salesforce Credentials**: Gather the necessary credentials, including Salesforce Base URL, Salesforce Object, Salesforce Username, Salesforce Password, Salesforce Consumer Key, Salesforce Consumer Secret
2. **Open Pipeline Editor**: In your BuiltAPI Workspace, navigate to the Pipelines section and click on the "Create Pipeline" button.
3. **Select `Salesforce Import Records` Connector**: From the list of available connectors, choose the `Salesforce Import Records` connector.
4. **Configure Connector Parameters**:
- Enter the Salesforce Base URL, Salesforce Object, Salesforce Username, Salesforce Password, Salesforce Consumer Key, Salesforce Consumer Secret.
- Select or Create the Target Entity where you want to store the imported records.
- Click on "Create pipeline" button
5. **Set schedule**:
- Open "Schedule" tab
- Click on "+ Create Schedule" button
- In the "Create Schedule" window, configure the schedule settings
- Click on "Create schedule" button


## Validation and Debugging
* Check last run status and logs to verify if the pipeline executed successfully.
* Inspect the target entity to ensure that the imported data is stored correctly.