Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
clientell-ai avatar

Sf Data

  • 40 installs
  • 12 repo stars
  • Updated July 14, 2026
  • clientell-ai/salesforce-skills

sf-data is an agent skill that guides Salesforce Bulk API 2.0 ingest jobs using CLI and REST for large-scale upserts and deletes.

About

sf-data is a Salesforce data operations reference skill for solo builders and small teams who must move thousands of rows into or out of an org without clicking through the UI. It walks the Bulk API 2.0 ingest lifecycle end to end: create the job, upload CSV batches, close the job, poll until processing finishes, then download success and failure artifacts. Commands use the Salesforce CLI for upsert and delete with external ID fields, while parallel REST examples show how to drive the same flow with curl when automation runs outside the CLI. The material assumes you already have org authentication, object metadata, and CSVs prepared; it does not replace data modeling or security review. Install it when you are building SaaS backends, migration scripts, or agent-driven ETL that must stay inside Salesforce governor-friendly bulk patterns instead of naive row-by-row APIs.

  • Documents a 6-step Bulk API 2.0 lifecycle from job creation through failed-record retrieval
  • Includes sf data bulk upsert and bulk delete CLI examples with wait flags
  • Provides REST curl flows for create job, upload CSV, close job, poll status, and fetch results
  • Covers upsert with externalIdFieldName and CSV lineEnding settings
  • Oriented to v60.0 REST ingest jobs and org-authenticated Bearer tokens

Sf Data by the numbers

  • 40 all-time installs (skills.sh)
  • Ranked #3,287 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-data

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs40
repo stars12
Security audit3 / 3 scanners passed
Last updatedJuly 14, 2026
Repositoryclientell-ai/salesforce-skills

What it does

Run Salesforce Bulk API 2.0 upserts and deletes with sf CLI and REST when syncing large Account or custom object datasets.

Who is it for?

Best when you're integrating a product with Salesforce and already have an org, external IDs, and CSV exports ready.

Skip if: Skip if you only need SOQL queries, single-record CRUD, or Salesforce setup without bulk data movement.

When should I use this skill?

When implementing or debugging Salesforce Bulk API 2.0 upsert, delete, or CSV ingest jobs via sf CLI or REST.

What you get

You complete a full bulk ingest or delete job with polling and failed-record recovery using documented sf and REST steps.

  • Completed bulk ingest or delete job
  • Job status polling results and failed-record export for remediation

By the numbers

  • 6-step Bulk API 2.0 job lifecycle: Create Job → Upload CSV → Close Job → Poll Status → Get Results → Get Failed Records

Files

SKILL.mdMarkdownGitHub ↗

Data Migration & Management

You are a Salesforce data specialist. Handle data operations safely and efficiently.

Data Operations

Query and Export

# Query records
sf data query -q "SELECT Id, Name, Industry FROM Account WHERE Industry != null LIMIT 100" --target-org myOrg

# Export to CSV
sf data query -q "SELECT Id, Name, Industry FROM Account" --target-org myOrg --result-format csv > accounts.csv

# Export to JSON
sf data query -q "SELECT Id, Name FROM Account" --target-org myOrg --result-format json > accounts.json

# Bulk query (large datasets)
sf data query -q "SELECT Id, Name FROM Account" --target-org myOrg --bulk

Import and Upsert

# Insert records from CSV
sf data import tree -f data/accounts.json --target-org myOrg

# Bulk upsert
sf data upsert bulk -s Account -f accounts.csv -i External_Id__c --target-org myOrg

# Insert with plan (preserves relationships)
sf data import tree -p data/plan.json --target-org myOrg

Data Plan for Related Records

[
    {
        "sobject": "Account",
        "saveRefs": true,
        "resolveRefs": false,
        "files": ["Account.json"]
    },
    {
        "sobject": "Contact",
        "saveRefs": false,
        "resolveRefs": true,
        "files": ["Contact.json"]
    }
]

Sandbox Seeding Script

#!/bin/bash
# seed-sandbox.sh — Create test data in a sandbox

ORG_ALIAS="${1:-sandbox}"

echo "Seeding data in $ORG_ALIAS..."

# Insert accounts
sf data import tree -f data/seed/accounts.json --target-org "$ORG_ALIAS"

# Insert contacts (references accounts)
sf data import tree -f data/seed/contacts.json --target-org "$ORG_ALIAS"

# Insert opportunities
sf data import tree -f data/seed/opportunities.json --target-org "$ORG_ALIAS"

echo "Seeding complete."

Anonymous Apex for Data Setup

# Run anonymous Apex for complex data setup
sf apex run -f scripts/seed-data.apex --target-org myOrg
// scripts/seed-data.apex
List<Account> accounts = new List<Account>();
for (Integer i = 0; i < 100; i++) {
    accounts.add(new Account(
        Name = 'Test Account ' + i,
        Industry = 'Technology',
        BillingState = 'CA'
    ));
}
insert accounts;
System.debug('Inserted ' + accounts.size() + ' accounts');

Data Cleanup

# Delete records matching criteria
sf data delete bulk -s Account -f delete-ids.csv --target-org myOrg

# Delete all records of a type (careful!)
sf data query -q "SELECT Id FROM TempObject__c" --target-org myOrg --result-format csv > to-delete.csv
sf data delete bulk -s TempObject__c -f to-delete.csv --target-org myOrg

Bulk API 2.0

Use for datasets >2,000 records. Significantly faster than standard API.

# Bulk upsert from CSV
sf data upsert bulk -s Account -f accounts.csv -i External_Id__c --target-org myOrg

# Bulk delete from CSV (Id column required)
sf data delete bulk -s Account -f delete-ids.csv --target-org myOrg

# Check job status
sf data bulk results -i <jobId> --target-org myOrg
  • Job timeout: 10 minutes for ingest, 15 minutes for query
  • Max file size: 150 MB per CSV
  • Max 150M records per 24-hour rolling window

External ID Best Practices

  • Choose fields that are unique across source and target orgs
  • Mark as External ID AND Unique for upsert idempotency
  • Cannot use masked fields as external IDs (Data Mask limitation)
  • For cross-org sync: use a UUID or composite key (OrgId + RecordId)

Relationship Loading Order

1. Independent objects (no required lookups) 2. Parent objects (Account before Contact) 3. Master-detail parents MUST exist before child insert 4. Junction objects (M2M) load after both parent objects 5. Self-referential records: two-pass load (insert without self-ref, then update)

Record Type Mapping

  • Export record type developer names (not IDs) — IDs differ between orgs
  • Validate picklist values exist in target before loading
  • Map with: sf data query -q "SELECT Id, DeveloperName FROM RecordType WHERE SObjectType='Account'"

File Migration (ContentVersion)

ContentVersion cv = new ContentVersion();
cv.Title = 'My File';
cv.PathOnClient = 'myfile.pdf';
cv.VersionData = Blob.valueOf('file content'); // or Base64-decoded
insert cv;
  • ContentDocumentLink associates files with records
  • Max file size: 2 GB (Salesforce Files)
  • Attachments (legacy) → migrate to ContentVersion

Rules

  • Always verify target org before data operations
  • Use --dry-run or LIMIT clauses when testing queries
  • Preserve referential integrity — load parent records before children
  • Use External IDs for upsert operations to avoid duplicates
  • Back up data before destructive operations
  • Use Bulk API for datasets > 200 records

Gotchas

  • Master-detail parent record MUST exist before child insert — otherwise ENTITY_IS_DELETED or REQUIRED_FIELD_MISSING
  • External ID fields cannot be masked in Salesforce Data Mask
  • Bulk API jobs timeout after 10-15 minutes — split large datasets
  • Polymorphic lookups (e.g., Task.WhatId) need TYPEOF in export queries
  • ContentVersion requires PathOnClient AND VersionData — both mandatory
  • Self-referential records (e.g., Account.ParentId) require two-pass load
  • Bulk API 2.0 returns success for the job even if individual records fail — always check results
  • Data Loader truncates field values silently if they exceed field length

References

  • Data Patterns — Bulk API 2.0, Composite API, tree export, external IDs, large data volumes, Big Objects, file upload, multi-currency, ETL, backup/recovery

Workflow

1. Verify target org connection 2. Analyze data requirements (objects, relationships, volume) 3. Export or generate source data 4. Create import plan with correct object order 5. Execute import with appropriate method (tree, bulk, anonymous Apex) 6. Verify data integrity post-import

Related skills

How it compares

Use for Bulk API 2.0 batch jobs, not as a substitute for Salesforce metadata deployment or interactive admin wizards.

FAQ

Who is sf-data for?

Developers and integrators automating Account or custom object loads and deletes in Salesforce orgs via bulk ingest.

When should I use sf-data?

During Build integrations while implementing migration scripts, nightly sync jobs, or agent workflows that upsert or delete CSV-backed Salesforce records at scale.

Is sf-data safe to install?

Bulk jobs can modify production data; review the Security Audits panel on this page, test in a sandbox, and scope API tokens before running delete or upsert in live orgs.

Backend & APIsintegrationsbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.