Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsforce

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsforce

Salesforce API Library for JavaScript

  • 2.0.0-alpha.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
361K
decreased by-26.22%
Maintainers
1
Weekly downloads
 
Created

What is jsforce?

The jsforce npm package is a powerful library for interacting with Salesforce from Node.js. It provides a comprehensive set of tools for working with Salesforce's REST API, SOAP API, Bulk API, and more. This makes it an excellent choice for developers looking to integrate Salesforce with their Node.js applications.

What are jsforce's main functionalities?

Authentication

This feature allows you to authenticate with Salesforce using a username, password, and security token. Once authenticated, you can perform various operations on Salesforce data.

const jsforce = require('jsforce');
const conn = new jsforce.Connection();
conn.login('username@example.com', 'password+securityToken', function(err, userInfo) {
  if (err) { return console.error(err); }
  console.log('User ID: ' + userInfo.id);
  console.log('Org ID: ' + userInfo.organizationId);
});

Querying Data

This feature allows you to query Salesforce data using SOQL (Salesforce Object Query Language). The example demonstrates how to fetch Account records.

const jsforce = require('jsforce');
const conn = new jsforce.Connection();
conn.login('username@example.com', 'password+securityToken', function(err, userInfo) {
  if (err) { return console.error(err); }
  conn.query('SELECT Id, Name FROM Account', function(err, result) {
    if (err) { return console.error(err); }
    console.log('Total records: ' + result.totalSize);
    console.log('Fetched records: ' + result.records.length);
  });
});

CRUD Operations

This feature allows you to perform CRUD (Create, Read, Update, Delete) operations on Salesforce objects. The example shows how to create a new Account record.

const jsforce = require('jsforce');
const conn = new jsforce.Connection();
conn.login('username@example.com', 'password+securityToken', function(err, userInfo) {
  if (err) { return console.error(err); }
  conn.sobject('Account').create({ Name: 'New Account' }, function(err, ret) {
    if (err || !ret.success) { return console.error(err, ret); }
    console.log('Created record id: ' + ret.id);
  });
});

Bulk API

This feature allows you to perform bulk operations on Salesforce data, which is useful for handling large volumes of records efficiently. The example demonstrates how to insert multiple Account records using the Bulk API.

const jsforce = require('jsforce');
const conn = new jsforce.Connection();
conn.login('username@example.com', 'password+securityToken', function(err, userInfo) {
  if (err) { return console.error(err); }
  const records = [{ Name: 'Account 1' }, { Name: 'Account 2' }];
  conn.bulk.load('Account', 'insert', records, function(err, rets) {
    if (err) { return console.error(err); }
    for (let i = 0; i < rets.length; i++) {
      if (rets[i].success) {
        console.log('Created record id: ' + rets[i].id);
      } else {
        console.log('Error: ' + rets[i].errors.join(', '));
      }
    }
  });
});

Other packages similar to jsforce

Keywords

FAQs

Package last updated on 07 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc