| name | salesforce-core-workflow-a |
| description | Execute Salesforce CRUD operations on standard sObjects with SOQL and REST API.
Use when creating, reading, updating, or deleting Accounts, Contacts, Leads,
or Opportunities via the Salesforce API.
Trigger with phrases like "salesforce CRUD", "salesforce create record",
"salesforce update account", "salesforce SOQL query", "salesforce REST API".
|
| 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 A — CRUD & SOQL
Overview
Primary workflow: perform CRUD operations on standard sObjects (Account, Contact, Lead, Opportunity) using SOQL queries, jsforce methods, and REST API endpoints.
Prerequisites
- Completed
salesforce-install-auth setup
- jsforce installed and connection configured
- Understanding of Salesforce sObject model
Instructions
Step 1: SOQL Queries (Read Operations)
import { getConnection } from './salesforce/connection';
const conn = await getConnection();
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
`);
const accountsWithContacts = await conn.query(`
SELECT Id, Name, Industry,
(SELECT Id, FirstName, LastName, Email FROM Contacts)
FROM Account
WHERE Industry = 'Technology'
LIMIT 20
`);
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
`);
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)`
);
Step 2: Create Records
newLead = conn.().({
: ,
: ,
: ,
: ,
: ,
: ,
});
.(, newLead.);
newContact = conn.().({
: ,
: ,
: ,
: ,
: ,
});
newOpp = conn.().({
: ,
: ,
: ,
: ,
: ,
});