Skip to main content Home Creators jeremylongshore tons-of-skills-marketplace salesforce-core-workflow-b
salesforce-core-workflow-b Execute Salesforce Bulk API 2.0 and Composite API operations for high-volume data.
Use when importing/exporting large datasets, performing multi-object transactions,
or chaining dependent API calls.
Trigger with phrases like "salesforce bulk API", "salesforce composite",
"salesforce batch", "salesforce mass import", "salesforce large data".
Jump to install Skills Marketplace Discover and explore AI skills built by the community.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Copy promptShow prompt details A direct command skips the review prompt. Inspect the source before running it.
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill salesforce-core-workflow-bThe command stays on one line. Scroll horizontally to inspect it before copying.
Prefer a local copy? Download the files currently available to SkillsMP.
Download Zip Downloading... More from this repository
langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
name salesforce-core-workflow-b description Execute Salesforce Bulk API 2.0 and Composite API operations for high-volume data.
Use when importing/exporting large datasets, performing multi-object transactions,
or chaining dependent API calls.
Trigger with phrases like "salesforce bulk API", "salesforce composite",
"salesforce batch", "salesforce mass import", "salesforce large data".
allowed-tools Read, Write, Edit, Bash(npm:*), Grep version 1.7.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","crm","salesforce"] compatibility Designed for Claude Code
Salesforce Core Workflow B — Bulk & Composite API
Overview
High-volume data operations using Bulk API 2.0 (millions of records) and Composite API (multi-step transactions in a single call).
Prerequisites
Completed salesforce-install-auth setup
Understanding of salesforce-core-workflow-a (standard CRUD)
jsforce installed with connection configured
Instructions
Step 1: Bulk API 2.0 — Ingest (Insert/Update/Upsert/Delete)
import { getConnection } from './salesforce/connection' ;
import fs from 'fs' ;
const conn = await getConnection ();
const job = conn.bulk2 .createJob ({
operation : 'insert' ,
object : 'Contact' ,
});
const csvData = `FirstName,LastName,Email,AccountId
Alice,Johnson,alice@example.com,001xxxxxxxxxxxx
Bob,Williams,bob@example.com,001xxxxxxxxxxxx
Carol,Davis,carol@example.com,001xxxxxxxxxxxx` ;
const results = await conn.bulk2 .loadAndWaitForResults ({
object : 'Contact' ,
operation : 'insert' ,
input : csvData,
});
console .log ('Successful:' , results. . );
. ( , results. . );
( failure results. ) {
. ( );
}
successfulResults
length
console
log
'Failed:'
failedResults
length
for
const
of
failedResults
console
error
`Row ${failure.sf__Id} : ${failure.sf__Error} `
Step 2: Bulk API 2.0 — Query (Export)
const queryResults = await conn.bulk2 .query (
`SELECT Id, Name, Email, Account.Name
FROM Contact
WHERE CreatedDate >= LAST_N_DAYS:90`
);
let recordCount = 0 ;
for await (const record of queryResults) {
recordCount++;
console .log (`${record.Name} — ${record.Email} ` );
}
console .log (`Total exported: ${recordCount} ` );
Step 3: Bulk API 2.0 — File-Based Upload
const csvStream = fs.createReadStream ('contacts-import.csv' );
const bulkResults = await conn.bulk2 .loadAndWaitForResults ({
object : 'Contact' ,
operation : 'upsert' ,
externalIdFieldName : 'External_ID__c' ,
input : csvStream,
pollTimeout : 600000 ,
pollInterval : 5000 ,
});
console .log (`Processed: ${bulkResults.successfulResults.length} success, ${bulkResults.failedResults.length} failed` );
Step 4: Composite API — Multiple Operations in One Call
const compositeResult = await conn.request ({
method : 'POST' ,
url : '/services/data/v59.0/composite' ,
body : JSON .stringify ({
allOrNone : true ,
compositeRequest : [
{
method : 'POST' ,
url : '/services/data/v59.0/sobjects/Account/' ,
referenceId : 'newAccount' ,
body : { Name : 'Composite Corp' , Industry : 'Technology' },
},
{
method : 'POST' ,
url : '/services/data/v59.0/sobjects/Contact/' ,
referenceId : 'newContact' ,
body : {
FirstName : 'Jane' ,
LastName : 'Doe' ,
AccountId : '@{newAccount.id}' ,
Email : 'jane@composite.example.com' ,
},
},
{
method : 'POST' ,
url : '/services/data/v59.0/sobjects/Opportunity/' ,
referenceId : 'newOpp' ,
body : {
Name : 'Composite Deal' ,
AccountId : '@{newAccount.id}' ,
StageName : 'Prospecting' ,
CloseDate : '2026-12-31' ,
Amount : 100000 ,
},
},
],
}),
headers : { 'Content-Type' : 'application/json' },
});
Step 5: Composite Batch — Independent Operations
const batchResult = await conn.request ({
method : 'POST' ,
url : '/services/data/v59.0/composite/batch' ,
body : JSON .stringify ({
batchRequests : [
{
method : 'GET' ,
url : 'v59.0/sobjects/Account/001xxxxxxxxxxxx' ,
},
{
method : 'GET' ,
url : 'v59.0/query/?q=SELECT+Id,Name+FROM+Contact+LIMIT+5' ,
},
{
method : 'PATCH' ,
url : 'v59.0/sobjects/Account/001xxxxxxxxxxxx' ,
richInput : { Industry : 'Software' },
},
],
}),
headers : { 'Content-Type' : 'application/json' },
});
for (const result of batchResult.results ) {
console .log (`Status: ${result.statusCode} ` , result.result );
}
Step 6: Composite Graph — Complex Transaction Trees
const graphResult = await conn.request ({
method : 'POST' ,
url : '/services/data/v59.0/composite/graph' ,
body : JSON .stringify ({
graphs : [
{
graphId : 'graph1' ,
compositeRequest : [
{
method : 'POST' ,
url : '/services/data/v59.0/sobjects/Account/' ,
referenceId : 'acct1' ,
body : { Name : 'Graph Corp' },
},
{
method : 'POST' ,
url : '/services/data/v59.0/sobjects/Contact/' ,
referenceId : 'contact1' ,
body : {
LastName : 'Graph' ,
AccountId : '@{acct1.id}' ,
},
},
],
},
],
}),
headers : { 'Content-Type' : 'application/json' },
});
Bulk vs Composite Decision Guide Scenario API Why Import 10K+ records Bulk API 2.0 Handles millions, async processing Export large datasets Bulk API 2.0 Query Streaming, no memory issues Create Account + Contact + Opportunity Composite Single call, references between objects Fetch 5 unrelated records Composite Batch Parallel fetches, 1 API call Multi-object transaction Composite Graph All-or-none across object types < 200 records CRUD sObject Collections Simpler, synchronous, from workflow-a
Error Handling Error Cause Solution PROCESSING_HALTEDBulk job aborted Check failedResults for row-level errors InvalidBatchCSV format error Verify column headers match field API names ALL_OR_NONE_OPERATION_ROLLED_BACKComposite allOrNone failure Check individual subrequest errors MAX_BATCH_SIZE_EXCEEDEDToo many subrequests Composite: max 25, Batch: max 25 EXCEEDED_ID_LIMITToo many records in single bulk job Split into multiple jobs (max 150M records/job)
Resources
Next Steps For common errors and debugging, see salesforce-common-errors.