Skip to content
OpenSmartRoute
Skillv1.0.0

salesforce-hello-world

Create a minimal working Salesforce example with SOQL queries and sObject CRUD. Use when starting a new Salesforce integration, testing your setup, or learning basic Salesforce API patterns. Trigger w

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (plugins/saas-packs/salesforce-pack/skills/salesforce-hello-world/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill salesforce-hello-world. Copyright stays with the author (MIT).

Salesforce Hello World

Overview

Minimal working example: connect to Salesforce, run a SOQL query, and perform basic CRUD on standard sObjects (Account, Contact, Lead).

Prerequisites

  • Completed salesforce-install-auth setup
  • jsforce installed (npm install jsforce)
  • Valid credentials in environment variables

Instructions

Step 1: Connect and Query Accounts

import jsforce from 'jsforce';

const conn = new jsforce.Connection({
  loginUrl: process.env.SF_LOGIN_URL || 'https://login.salesforce.com',
});

await conn.login(
  process.env.SF_USERNAME!,
  process.env.SF_PASSWORD! + process.env.SF_SECURITY_TOKEN!
);

// Your first SOQL query — fetch 5 Accounts
const result = await conn.query(
  "SELECT Id, Name, Industry, AnnualRevenue FROM Account LIMIT 5"
);

console.log(`Total records: ${result.totalSize}`);
for (const account of result.records) {
  console.log(`  ${account.Name} — ${account.Industry ?? 'N/A'}`);
}

Step 2: Create a Record

// Create a new Account
const newAccount = await conn.sobject('Account').create({
  Name: 'Acme Corporation',
  Industry: 'Technology',
  Website: 'https://acme.example.com',
  NumberOfEmployees: 250,
});

console.log('Created Account ID:', newAccount.id);
console.log('Success:', newAccount.success);

Step 3: Read a Record by ID

// Retrieve specific fields by record ID
const account = await conn.sobject('Account').retrieve(newAccount.id);
console.log('Account Name:', account.Name);

// Or use SOQL for more control
const result = await conn.query(
  `SELECT Id, Name, Industry, CreatedDate
   FROM Account
   WHERE Id = '${newAccount.id}'`
);

Step 4: Update a Record

const updateResult = await conn.sobject('Account').update({
  Id: newAccount.id,
  Industry: 'Software',
  Description: 'Updated via jsforce API',
});
console.log('Updated:', updateResult.success);

Step 5: Delete a Record

const deleteResult = await conn.sobject('Account').destroy(newAccount.id);
console.log('Deleted:', deleteResult.success);

Python Example

from simple_salesforce import Salesforce
import os

sf = Salesforce(
    username=os.environ['SF_USERNAME'],
    password=os.environ['SF_PASSWORD'],
    security_token=os.environ['SF_SECURITY_TOKEN']
)

# SOQL query
result = sf.query("SELECT Id, Name, Industry FROM Account LIMIT 5")
for record in result['records']:
    print(f"  {record['Name']}{record.get('Industry', 'N/A')}")

# Create
new_account = sf.Account.create({'Name': 'Acme Corp', 'Industry': 'Technology'})
print(f"Created: {new_account['id']}")

# Update
sf.Account.update(new_account['id'], {'Industry': 'Software'})

# Delete
sf.Account.delete(new_account['id'])

Output

  • Successful SOQL query returning Account records
  • Created, read, updated, and deleted an Account sObject
  • Console output confirming each operation

Error Handling

Error Cause Solution
INVALID_FIELD Field name wrong in SOQL Check field API names in Setup > Object Manager
MALFORMED_QUERY SOQL syntax error Verify quotes, field names, WHERE clause
INVALID_TYPE sObject name wrong Use API name (e.g., Account, not Accounts)
REQUIRED_FIELD_MISSING Missing required field on create Add required fields (e.g., Name for Account)
ENTITY_IS_DELETED Record already deleted Query with isDeleted = true to find in Recycle Bin

Examples

Run a disposable CRUD smoke test in a sandbox

Authenticate with a sandbox-only integration user, create an Account whose name includes a unique test run ID, query it by that ID, and update only a non-sensitive test field. Assert the expected result count, delete the test record, and confirm it is absent from normal SOQL results. Never aim this tutorial at a production org or use real customer names; preserve only the run ID and pass/fail result in the test log.

Resources

Next Steps

Proceed to salesforce-local-dev-loop for development workflow setup.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-salesforce-he-3247b3/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-salesforce-he-3247b3.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-salesforce-he-3247b3",
  "kind": "skill",
  "name": "salesforce-hello-world",
  "description": "Create a minimal working Salesforce example with SOQL queries and sObject CRUD. Use when starting a new Salesforce integration, testing your setup, or learning basic Salesforce API patterns. Trigger with phrases like \"salesforce hello world\", \"salesforce example\", \"salesforce quick start\", \"first salesforce query\", \"salesforce SOQL\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general_chat",
      "coding"
    ],
    "tags": [
      "skill-md",
      "saas",
      "crm",
      "salesforce",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Create a minimal working Salesforce example with SOQL queries and sObject CRUD. Use when starting a new Salesforce integration, testing your setup, or learning basic Salesforce API patterns. Trigger with phrases like \"salesforce hello world\", \"salesforce example\", \"salesforce quick start\", \"first salesforce query\", \"salesforce SOQL\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "plugins/saas-packs/salesforce-pack/skills/salesforce-hello-world/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/plugins/saas-packs/salesforce-pack/skills/salesforce-hello-world/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/plugins/saas-packs/salesforce-pack/skills/salesforce-hello-world/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit"
    ],
    "license": "MIT"
  },
  "instructions": "# Salesforce Hello World\n\n## Overview\n\nMinimal working example: connect to Salesforce, run a SOQL query, and perform basic CRUD on standard sObjects (Account, Contact, Lead).\n\n## Prerequisites\n\n- Completed `salesforce-install-auth` setup\n- jsforce installed (`npm install jsforce`)\n- Valid credentials in environment variables\n\n## Instructions\n\n### Step 1: Connect and Query Accounts\n\n```typescript\nimport jsforce from 'jsforce';\n\nconst conn = new jsforce.Connection({\n  loginUrl: process.env.SF_LOGIN_URL || 'https://login.salesforce.com',\n});\n\nawait conn.login(\n  process.env.SF_USERNAME!,\n  proces",
  "cost": {
    "context_tokens": 1122
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-salesforce-he-3247b3/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.