JSforce (formerly Node-Salesforce) is an isomorphic JavaScript library designed for interacting with the Salesforce API, capable of running in both web browsers and Node.js environments. The current stable version is 3.10.14, with releases primarily focusing on bug fixes and dependency updates within the 3.x series, indicating an active maintenance cadence. It provides comprehensive access to various Salesforce APIs including REST, Apex REST, Analytics, Bulk, Chatter, Metadata, SOAP, Streaming, and Tooling APIs. A key differentiator is its broad API coverage and isomorphic design, allowing developers to use a single library across different JavaScript runtimes. It also offers a command-line interface with a REPL for interactive exploration and learning. This library is a mature and widely used solution for integrating JavaScript applications with Salesforce.
npm install jsforceVerified import paths — ran on the pinned version, not inferred.
This code snippet demonstrates how to establish a connection to Salesforce using jsforce, authenticate with username-password flow (suitable for scripts or backend services), perform a SOQL query to fetch account data, create a new Lead record, and then retrieve it. It highlights basic CRUD operations and error handling, showcasing the core interaction pattern with the Salesforce API.
Refer to the official 'MIGRATING_V1-V3.md' guide in the jsforce GitHub repository for detailed steps and code changes required for migration.
Consult the 'MIGRATING_V2-V3.md' guide within the jsforce GitHub repository for specific changes and updates needed.
Migrate authentication flows from `loginBySoap` to OAuth 2.0 Username-Password Flow or other OAuth 2.0 flows (e.g., Web Server Flow, JWT Bearer Flow) as appropriate for your application. Refer to Salesforce Release Notes for more information.
Always use a default import for the main library: `import jsforce from 'jsforce';` then access `jsforce.Connection` or `new jsforce.Connection(...)`. For CommonJS, use `const jsforce = require('jsforce');`.Verify username and password. Append your security token directly to the password if it's required and you haven't whitelisted your IP. Check Salesforce setup for IP ranges and user lockout status. Ensure the correct login URL (e.g., `https://test.salesforce.com` for sandboxes) is used.
Double-check the API name of the sObject. For custom objects, ensure the `__c` suffix is correct. Verify that the user has permissions to access the object.
Carefully review the SOQL query string for syntax errors. Validate field names and object names against your Salesforce schema. Test the query directly in the Salesforce Developer Console to isolate issues.
No dependency data recorded yet.