{"id":21442330,"url":"https://github.com/oegea/soap_salesforce","last_synced_at":"2025-03-17T00:45:54.388Z","repository":{"id":57364939,"uuid":"51196610","full_name":"oegea/soap_salesforce","owner":"oegea","description":"A NodeJS library that facilitates login into Salesforce SOAP API, and provides basic functionalities for calling most used Salesforce API methods.","archived":false,"fork":false,"pushed_at":"2016-07-12T14:33:39.000Z","size":1398,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T08:45:06.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oegea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-06T09:22:14.000Z","updated_at":"2016-02-06T09:48:22.000Z","dependencies_parsed_at":"2022-09-13T21:01:12.343Z","dependency_job_id":null,"html_url":"https://github.com/oegea/soap_salesforce","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oegea%2Fsoap_salesforce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oegea%2Fsoap_salesforce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oegea%2Fsoap_salesforce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oegea%2Fsoap_salesforce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oegea","download_url":"https://codeload.github.com/oegea/soap_salesforce/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955723,"owners_count":20374372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T01:53:53.504Z","updated_at":"2025-03-17T00:45:54.365Z","avatar_url":"https://github.com/oegea.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis\n\nsoap_salesforce is a library that facilitates login into Salesforce SOAP API, and provide basic functionality for calling most used Salesforce API methods.\nSpecifically 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.\n\nShort \"how to use\" guide is available ([here](https://www.oriol.im/how-to-consume-salesforce-soap-service-with-nodejs/)).\n\n## Code Example\n\n### Initializing and querying Salesforce\n\n```javascript\n//We will require soap_salesforce in order to call Salesforce SOAP API.\nvar salesforce = require(\"soap_salesforce\");\n//Create an instance of soap_salesforce.\nvar salesforceAPI = new salesforce(\"username\",\"password\",\"token\",\"enterprise wsdl xml path\");\n//Now, login to the API, it will return us a promise. \nsalesforceAPI.Login().then(function(soapClient){ //If everything goes ok we will recieve a soapClient object.\n    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\n    soapClient.queryAll(query, function(error, result){ //After executing queryAll method it will pass error and result variables to a callback function.\n        console.log(result); //This is what Salesforce returned us :)\n    });\n});\n```\n\n### Using helper methods\n\nsoap_salesforce provide two useful methods in addition to the methods we have already seen:\nOne 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.\n\n#### Escaping SOQL parameters\n\n```javascript\nvar accountName = \"Escape ' me % please _\"; //Unescaped parameter\naccountName = salesforceAPI.EscapeSOQL(accountName); //Escaped parameter.\nvar query = salesforceAPI.FormatQuery(\"SELECT Id FROM Account WHERE Name = '\"+accountName+\"' LIMIT 1\"); \nsoapClient.queryAll(query, function(error, result){ \n    console.log(result); \n});\n```\n\n#### Creating or editing a record\n\n```javascript\n//Define new account data\nvar newAccount = {\n    Name: \"Fake account\",\n    Description__c: \"Another field here :)\"\n };\n//Format it into an sObject\nvar newAccount = salesforceAPI.FormatObject(newAccount, \"Account\");\n\n//Now we can create the record\nsoapClient.create({sObjects: [newAccount]}, function(error, result){\n    console.log(result); //Result will be here, and the Id of the account we've just created.\n});\n```\n\n## Installation\n\nNPM is required for installing this library. \nIn order to install, open a terminal, place in your project's folder, and type `npm install soap_salesforce`.\n\n## Contributors\n\n* Oriol Egea ([@OriolEgea](http://twitter.com/OriolEgea))\n\n## License\n\nReleased under AGPL-V3.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foegea%2Fsoap_salesforce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foegea%2Fsoap_salesforce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foegea%2Fsoap_salesforce/lists"}