Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
15 votes
Accepted

What is the difference between JSFORCE and SFORCE?

Here they are: JSforce: This is a open source plugin to allow developers to connect to Salesforce from JavaScript. Here is the list of supported methods. From documentation: JSforce (f.k.a. Node-...
Raul's user avatar
  • 18.8k
9 votes
Accepted

How to retrieve all available page layouts for an object?

Use the Tooling API to query for the layouts: SELECT FullName FROM Layout WHERE TableEnumOrId = 'Contact' You can read more about the Tooling API REST Calls. Here's the raw endpoint you would use: ...
sfdcfox's user avatar
  • 494k
8 votes

How to use JsForce in a Salesforce Lightning Component

Why do I still get these errors (see below)? You've got two things working against you: CORB and Lightning Session Id. First, CORB is a new security feature that prevents certain types of resources ...
sfdcfox's user avatar
  • 494k
7 votes
Accepted

Call Standard salesforce rest api using jsfoce

I have figured this out. Posting answer hoping it would help others. var jsforce = require('jsforce'); var conn = new jsforce.Connection({ // you can change loginUrl to connect to sandbox or ...
user360's user avatar
  • 445
6 votes

large bulk insert/delete using jsforce

Looks like that number is an intentional API Limit. From the Bulk API Documentation: Batch size Batches for data loads can consist of a single CSV, XML, or JSON file that is no larger ...
battery.cord's user avatar
  • 8,835
6 votes

jsforce: retrieve metadata of a report with a row-level formula

This is a bug in jsforce. You can work around it by using Analytics API and specifying the latest API version (v52.0 as of this writing): var jsforce = require("jsforce"); var conn = new ...
identigral's user avatar
  • 7,644
5 votes
Accepted

How to call Standard REST service in POST request using JSforce?

SFDC has two ways of exposing REST API 1)Custom apex Built 2)Standard REST API You are trying to use JSForce for apex built while your endpoint is of Standard REST API . Use the below for ...
Mohith Shrivastava's user avatar
4 votes

Problem with JSForce

Your text says that you connect fine via OAuth, sign in, and get redirected. However, that's not apparent from the code you have posted, which has the pre-login initialization code and the post-...
Jon Freed's user avatar
  • 192
4 votes
Accepted

Salesforce OAuth giving invalid_grant(login.salesforce.com) or unsupported_grant_type(org url) error

1. First Make sure you have the right URLs The OAuth token endpoint for Sandbox has to be https://test.salesforce.com/services/oauth2/token The endpoint for Production or Developer org needs to be ...
Mohith Shrivastava's user avatar
4 votes
Accepted

JSforce query call not returning

@identigral had a good guess, and that StackOverflow article seemed like it might be on to something. But in the end, the root cause was something less obvious. This root problem turned out to be ...
Matthew Souther's user avatar
3 votes
Accepted

Help with JSforce query - 'Bind variables only allowed in Apex code'

The first error indicates your SOQL is incorrect. You need to use normal syntax, which includes proper quotes, parentheses, etc: conn.query( "SELECT RecordId FROM UserRecordAccess " + "WHERE ...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

How to set maxRequest in sfdx plugin? Error: exceeded max limit of concurrent call

[EDIT] Looks like the sfdx cli has updated its dependency over jsforce to 1.9.3, so you should be able to use the core library directly now. [ORIGINAL ANSWER] I had the same issue, but wasn't able to ...
Fabien Taillon's user avatar
3 votes
Accepted

I am querying more than 2000 records. Is it a good idea to use the BULK API?

Synchronizing the entire data set every 5-10 minutes is very inefficient, whether you are using the Bulk or REST API. While the Bulk API could work for this purpose, it is an asynchronous API, and ...
David Reed's user avatar
  • 93.1k
3 votes
Accepted

I want to use JSForce to create a custom field on the Contact Object using the metadata API

JSForce is just a "wrapper" for the metadata API (another other APIs). To use it, you need to specify a smorgasbord of options depending on what you're doing with the field. You will want to refer to ...
sfdcfox's user avatar
  • 494k
3 votes

Best practice for reconnecting with jsforce?

Logging in every request will consume a lot of API calls. Don't do it. Preferably, use a refresh token, as outlined in the documentation. Otherwise, simply try your call, and if you get an error, ...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

Invoking metadata API call using JSFORCE

From the metadata documentation for the retrieve call in SFDC, metadata requires any of the below. Package name or list of packages you want to retrieve the metadata info for A package.xml consisting ...
Mohith Shrivastava's user avatar
3 votes
Accepted

Jsforce in Lightning Component controller

Lightning Component: Add required scripts to component. scripts should be in static resources. <ltng:require scripts="{!$Resource.ABC + '/lib/jsforce.min.js'}"/> Controller: Authorize ...
Sriram's user avatar
  • 701
3 votes
Accepted

Download ContentVersion Object as JPG using JSForce

Here is a sample JS fetch request I converted in Postman (this is pseudocode and probably wont work). I use the the following endpoint /services/data/v48.0/sobjects/Attachment/<ATTACHMENT_FILE_ID&...
Max Goldfarb's user avatar
3 votes
Accepted

Can I use jsforce to launch/invoke a lightning flow

You can send an arbitrary request to Salesforce, and it so happens that you can call a Flow directly. First, build the request as: var _request = { url: '/services/data/v54.0/actions/custom/flow/...
sfdcfox's user avatar
  • 494k
2 votes
Accepted

Is JSforce safe to use?

User name and password is being populated on server side only. In your example JSForce user name and password is being used by Node.js and Command Line. In web browser you pupulate your Salesforce ...
Ruslan Vekua's user avatar
2 votes

How to retrieve all available page layouts for an object?

Another way using only command line interface is to get the complete list of layouts and then filter and clean lines to get the complete list of layouts : sfdx force:mdapi:listmetadata -m Layout -u ...
Emmanuel BRUNO's user avatar
2 votes
Accepted

Metadata Deploy from JSforce doesn't work in production

It turns out the answer was simple. In production orgs, you must specify rollbackOnError: true in your deploy options JSForceService.conn.metadata.deploy(emailTrigger, { testLevel: 'RunLocalTests', ...
MoDiggity's user avatar
  • 403
2 votes
Accepted

Inserting a record with a Master-Detail type field into a custom object using JSforce

Your logic should be: Query the Salesforce Id of Parent (Person__c is its a custom object) record from DataBase using SOQL. Create using create operation if it does not exists, you would get ...
Raul's user avatar
  • 18.8k
2 votes

SOQL Order By field in child relationship

Seems like a great use case for a rollup. Create a field on Opportunity named something like Most_Recent_Foo__c (obviously change foo to something more meaningful). Install Declarative Rollup ...
Adrian Larson's user avatar
  • 150k
2 votes
Accepted

Third party lead generation service scope access for creating new leads

TL/TR: You want to use a Connected App. Lightning Connect: Lightning Connect reaches out to external data in ODATA (2.0 / 4.0) format. No data is pulled into Salesforce, but is kept in the external ...
stwissel's user avatar
  • 379
2 votes

invalid_grant: expired access/refresh token with refresh token included in JSForce

You don't need to create a new connection on a refresh. This will cause problems. You can use the handler to store the access token, but you should not be forcing a new connection.
sfdcfox's user avatar
  • 494k
2 votes
Accepted

Query Data with JSforce Using Connected App

But I don't want to use the user name/password. Is it possible to avoid it and make the connection only by using the connected app? Providing username/password is to make sure you are authenticating ...
Jayant Das's user avatar
  • 30.6k
2 votes

How to use "jsforce" in an external HTML client for streaming api?

This is a more general programming question, but since this is a Salesforce library I think an answer fits on our site. The require() function that you're calling is typically provided by a web build ...
Matt Lacey's user avatar
  • 25.6k
2 votes
Accepted

How to get all records from Report using JSforce NodeJS

This is a documented limitation of the Analytics API: The API returns up to the first 2,000 report rows. You can narrow results using filters. You could approach this by segmenting your data using ...
David Reed's user avatar
  • 93.1k
2 votes
Accepted

jsforce query on ContentVersion returns the url rather than Base64 value

The reason for JSForce responding back with the URLs is because JSForce is using the REST API and that won't return back the Base64 content. Salesforce's SOAP API will however though when you issue a ...
Bryan Anderson's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible