From salesforce-pack
Executes CRUD operations on Salesforce Accounts, Contacts, Leads, Opportunities using SOQL queries and jsforce/REST API. For Node.js apps needing Salesforce data manipulation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/salesforce-pack:salesforce-core-workflow-aThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Primary workflow: perform CRUD operations on standard sObjects (Account, Contact, Lead, Opportunity) using SOQL queries, jsforce methods, and REST API endpoints.
Primary workflow: perform CRUD operations on standard sObjects (Account, Contact, Lead, Opportunity) using SOQL queries, jsforce methods, and REST API endpoints.
salesforce-install-auth setupimport { getConnection } from './salesforce/connection';
const conn = await getConnection();
// Basic query — all open opportunities closing this quarter
const opps = await conn.query(`
SELECT Id, Name, Amount, StageName, CloseDate, Account.Name
FROM Opportunity
WHERE IsClosed = false
AND CloseDate = THIS_QUARTER
ORDER BY Amount DESC
LIMIT 50
`);
// Relationship query — Accounts with their Contacts
const accountsWithContacts = await conn.query(`
SELECT Id, Name, Industry,
(SELECT Id, FirstName, LastName, Email FROM Contacts)
FROM Account
WHERE Industry = 'Technology'
LIMIT 20
`);
// Aggregate query
const revByIndustry = await conn.query(`
SELECT Industry, COUNT(Id) numAccounts, SUM(AnnualRevenue) totalRevenue
FROM Account
WHERE Industry != null
GROUP BY Industry
ORDER BY SUM(AnnualRevenue) DESC
`);
// SOSL search — full-text search across objects
const searchResults = await conn.search(
`FIND {Acme} IN ALL FIELDS RETURNING
Account(Id, Name, Industry),
Contact(Id, FirstName, LastName, Email),
Lead(Id, Name, Company, Status)`
);
// Single record create via sObject
const newLead = await conn.sobject('Lead').create({
FirstName: 'Jane',
LastName: 'Smith',
Company: 'Acme Corp',
Email: '[email protected]',
Status: 'Open - Not Contacted',
LeadSource: 'Web',
});
console.log('Lead ID:', newLead.id); // '00Qxx...'
// Create with relationship (Contact linked to Account)
const newContact = await conn.sobject('Contact').create({
FirstName: 'John',
LastName: 'Doe',
Email: '[email protected]',
AccountId: '001xxxxxxxxxxxx', // Existing Account ID
Title: 'VP Engineering',
});
// Create Opportunity with all key fields
const newOpp = await conn.sobject('Opportunity').create({
Name: 'Acme Corp — Enterprise License',
AccountId: '001xxxxxxxxxxxx',
StageName: 'Prospecting',
CloseDate: '2026-06-30',
Amount: 50000,
});
// Create up to 200 records in a single API call (sObject Collections)
const contacts = [
{ FirstName: 'Alice', LastName: 'A', Email: '[email protected]', AccountId: '001xx' },
{ FirstName: 'Bob', LastName: 'B', Email: '[email protected]', AccountId: '001xx' },
{ FirstName: 'Carol', LastName: 'C', Email: '[email protected]', AccountId: '001xx' },
];
const results = await conn.sobject('Contact').create(contacts);
// Returns array: [{ id: '003xx', success: true }, ...]
// Check for partial failures
for (const result of results) {
if (!result.success) {
console.error('Failed:', result.errors);
}
}
// Single update
await conn.sobject('Opportunity').update({
Id: '006xxxxxxxxxxxx',
StageName: 'Qualification',
Amount: 75000,
Description: 'Upgraded after demo call',
});
// Bulk update (up to 200)
const updates = [
{ Id: '003xx1', Title: 'Senior Engineer' },
{ Id: '003xx2', Title: 'Staff Engineer' },
{ Id: '003xx3', Title: 'Principal Engineer' },
];
await conn.sobject('Contact').update(updates);
// Upsert uses an External ID field to match existing records
// Requires a custom External ID field on the sObject
await conn.sobject('Account').upsert({
External_ID__c: 'EXT-12345', // Custom external ID field
Name: 'Acme Corporation',
Industry: 'Technology',
Website: 'https://acme.example.com',
}, 'External_ID__c'); // Field to match on
// Single delete
await conn.sobject('Lead').destroy('00Qxxxxxxxxxxxx');
// Bulk delete (up to 200)
const idsToDelete = ['00Qxx1', '00Qxx2', '00Qxx3'];
await conn.sobject('Lead').destroy(idsToDelete);
// When jsforce doesn't wrap what you need, use raw REST
// GET — describe an sObject
const accountMeta = await conn.request(
'/services/data/v59.0/sobjects/Account/describe'
);
console.log('Fields:', accountMeta.fields.map((f: any) => f.name));
// POST — create via REST
const created = await conn.request({
method: 'POST',
url: '/services/data/v59.0/sobjects/Account/',
body: JSON.stringify({ Name: 'REST Created Account' }),
headers: { 'Content-Type': 'application/json' },
});
// PATCH — update via REST
await conn.request({
method: 'PATCH',
url: `/services/data/v59.0/sobjects/Account/${created.id}`,
body: JSON.stringify({ Industry: 'Consulting' }),
headers: { 'Content-Type': 'application/json' },
});
| Error | Cause | Solution |
|---|---|---|
INVALID_FIELD | Wrong field API name in SOQL | Use Object Manager to check field names |
REQUIRED_FIELD_MISSING | Create missing required fields | Check Setup > Object Manager > Fields for required |
DUPLICATE_VALUE | Unique field constraint violated | Check External ID or unique field values |
INSUFFICIENT_ACCESS_OR_READONLY | Missing object/field permissions | Check Profile or Permission Set assignments |
UNABLE_TO_LOCK_ROW | Concurrent update on same record | Retry with backoff — common in high-volume writes |
ENTITY_IS_DELETED | Operating on deleted record | Query Recycle Bin or use ALL ROWS in SOQL |
For Bulk API and Composite API patterns, see salesforce-core-workflow-b.
npx claudepluginhub ia23a-lachnita/claude-code-plugins-plus-fix-skills --plugin salesforce-pack5plugins reuse this skill
First indexed Jul 10, 2026
Executes Salesforce CRUD operations on standard sObjects using SOQL and REST API. Activate with phrases like 'salesforce CRUD' or 'salesforce SOQL query'.
Automates Salesforce CRM tasks (leads, contacts, accounts, opportunities, SOQL) via Rube MCP using Composio's Salesforce toolkit. Automatically searches tools for current schemas.
Automates Salesforce CRM operations (leads, contacts, accounts, opportunities, SOQL) via Composio's Salesforce toolkit through Rube MCP.