npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

soap_salesforce

v1.1.2

Published

A NodeJS library that facilitates login into Salesforce SOAP API, and provide basic functionality for calling most used Salesforce API methods.

Readme

Synopsis

soap_salesforce is a library that facilitates login into Salesforce SOAP API, and provide basic functionality for calling most used Salesforce API methods. Specifically it is designed to be used with an Enterprise WSDL, but it can be easily adapted in order to use other kind of Salesforce WSDL files.

Short "how to use" guide is available (here).

Code Example

Initializing and querying Salesforce

//We will require soap_salesforce in order to call Salesforce SOAP API.
var salesforce = require("soap_salesforce");
//Create an instance of soap_salesforce.
var salesforceAPI = new salesforce("username","password","token","enterprise wsdl xml path");
//Now, login to the API, it will return us a promise. 
salesforceAPI.Login().then(function(soapClient){ //If everything goes ok we will recieve a soapClient object.
    var query = salesforceAPI.FormatQuery("SELECT Id FROM Account LIMIT 1"); //This method will format a string into a object ready for be used in a queryAll call
    soapClient.queryAll(query, function(error, result){ //After executing queryAll method it will pass error and result variables to a callback function.
        console.log(result); //This is what Salesforce returned us :)
    });
});

Using helper methods

soap_salesforce provide two useful methods in addition to the methods we have already seen: One for escaping characters in a SOQL sentence, and other for formatting a javascript object in order to pass it as a parameter when creating or editing Salesforce records.

Escaping SOQL parameters

var accountName = "Escape ' me % please _"; //Unescaped parameter
accountName = salesforceAPI.EscapeSOQL(accountName); //Escaped parameter.
var query = salesforceAPI.FormatQuery("SELECT Id FROM Account WHERE Name = '"+accountName+"' LIMIT 1"); 
soapClient.queryAll(query, function(error, result){ 
    console.log(result); 
});

Creating or editing a record

//Define new account data
var newAccount = {
    Name: "Fake account",
    Description__c: "Another field here :)"
 };
//Format it into an sObject
var newAccount = salesforceAPI.FormatObject(newAccount, "Account");

//Now we can create the record
soapClient.create({sObjects: [newAccount]}, function(error, result){
    console.log(result); //Result will be here, and the Id of the account we've just created.
});

Installation

NPM is required for installing this library. In order to install, open a terminal, place in your project's folder, and type npm install soap_salesforce.

Contributors

License

Released under AGPL-V3.