The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Loading large Data sets with Bulk API 2.0 and avoiding common failures (opens in a new tab)

You will learn how Bulk API 2.0 jobs work, the limits that govern them, and practices such as external-ID upserts, load ordering and failure reconciliation that keep large loads repeatable.

  1. Create job
  2. Upload CSV
  3. Close job
  4. Check job status
  5. Download failed records
The job flow Bulk API 2.0 follows from creation to completion

Bulk API 2.0 is Salesforce’s asynchronous data-loading API. Rather than sending records one request at a time, you create a job, upload a CSV file, close the job, and check its status while Salesforce processes the records in the background. Success and failure files are available for download, so the outcome of every record can be accounted for.

The article recommends it for thousands of records or more, such as migrations, nightly syncs and bulk cleanups, and suggests the standard Data Loader or Import Wizard for smaller volumes. It stresses that a bulk load multiplies the quality of its source file, so data should be cleaned first by standardizing picklist values, deduplicating and validating required fields.

Five practices are offered. Upsert against a stable External ID so re-runs do not create duplicates. Keep files within the limits of 150 MB per CSV and 150 million records per job, splitting very large loads into logical chunks. Watch the job through its states of Open, UploadComplete, InProgress and JobComplete, and download the failed-records file, which gives an error per row. Respect the daily limits of 10,000 Bulk API batches per rolling 24 hours and 15,000 Bulk API 2.0 jobs per day in most editions. Load parent records before children.

The piece also notes gotchas. Validation Rules still fire, so blocked rows fail while the rest succeed. Triggers and Flows run on every record and can slow the job or hit governor limits, so non-essential automation may be deactivated during a migration window. The hardDelete operation is permanent and skips the Recycle Bin, so it should be tested on a small batch first.

Read the original at dev.to (opens in a new tab)

Worth reading?

Recommended

Upserting Contacts to Accounts with an External ID in Data Loader (opens in a new tab)

You will learn how to set up a unique External ID on Account, load Accounts before Contacts, and map the source key to relate them without a post-load VLOOKUP.

Why read this

You will also see which reference fields cannot be mapped to External IDs and what still breaks.

  1. Create unique External ID on Account
  2. Back up and test a small subset
  3. Upsert Accounts
  4. Upsert Contacts, mapping Account:External_ID__c
The order of operations for relating Contacts to Accounts by External ID

Relationships in Salesforce are stored as record IDs, so a source system’s Account key in a Contact file cannot be used as AccountId. The walkthrough follows Salesforce Help: create or reuse a unique External ID field on Account, load Accounts first (insert, or upsert for reruns), then upsert Contacts and map the source-key column to the Account:External_ID__c field.

The steps include backing up and testing with a small subset, and the Data Loader wording is quoted from Salesforce Help rather than a live run. The example data is invented and was not loaded into an org. A Contact whose key is missing from the Accounts will fail, and that failure appears in the error file.

The piece lists the main failure causes: blank or non-unique External IDs, child rows loaded before the parent, and Lookup Filters or Validation Rules. It also notes that Polymorphic Fields and a Custom Object’s Owner cannot be mapped to External IDs, and that a successful upsert does not prove the source key was correct.

Read the original at dev.to (opens in a new tab)

Worth reading?

Must-read

Migrating HubSpot to Salesforce: External IDs, upsert, and load order (opens in a new tab)

Readers will learn how to structure a reliable HubSpot to Salesforce data migration using External IDs, proper load ordering, and Bulk API, including strategies for handling hierarchies, deltas, and validation.

  1. Cleanse data and map picklists
  2. Dry run in sandbox with disabled automations
  3. Load records following dependency order
  4. Enable read only mode and run delta load
  5. Verify record counts and relationship integrity
Phased migration process from HubSpot to Salesforce

The article addresses the complexity of moving historical records and relationships from HubSpot to Salesforce, emphasizing that simple export import fails due to differing data models. It establishes the External ID field as the foundation for tracking records, enabling idempotent upserts, and linking related objects without relying on Salesforce generated identifiers.

It outlines a strict dependency sequence for loading records, starting with Users and Accounts before moving to Contacts, Opportunities, and Activities. Special attention is given to Account hierarchies, recommending a two pass approach to avoid parent child reference errors. The piece includes a Python example using the Bulk API to demonstrate upserting an Opportunity by matching its Account via an External ID rather than a native Salesforce identifier.

Before migration, the author stresses data cleansing, deduplication rules, and mapping picklist values like pipeline stages. A sandbox dry run is recommended to generate repeatable error reports and to temporarily disable automations such as Flow and Apex triggers that could trigger unwanted side effects during bulk loads.

The final phase uses a delta load strategy to capture changes made after the initial bulk transfer, requiring source system read only mode and timestamp tracking. Post migration validation involves comparing record counts, verifying relationship integrity, reconciling financial totals, and spot checking field values to ensure data accuracy before full team adoption.

Read the original at dev.to (opens in a new tab)

Worth reading?