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-...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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&...
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/...
3
votes
What could we use as an alternative to JSForce
As I understand it, jsforce is not directly a Salesforce created/provided library, but they support it. Is that correct?
No, it is neither maintained or supported by Salesforce. It is open source, so ...
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 ...
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', ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
2
votes
Accepted
Filter quotes by owner division SOQL
The reason this query doesn't work is because for Quote, the OwnerId field is polymorphic to both User and Group
So, you need to use a polymorphic query:
SELECT GrandTotal FROM Quote WHERE Owner....
2
votes
Accepted
Where does this Column come from (In Sql Query)?
This is simply part of how Salesforce handles relationships.
OwnerId, the field, indicates a relationship to the Owner object (well, the field is owner, the actual object is User). It's also not just ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
jsforce × 125javascript × 26
node.js × 24
rest-api × 14
metadata-api × 10
apex × 9
api × 9
soql × 8
query × 7
node-salesforce × 7
salesforcedx × 6
oauth2 × 6
bulk-api × 6
visualforce × 5
lightning-web-components × 5
connected-apps × 4
contentversion × 4
soap-api × 3
attachment × 3
soap × 3
oauth × 3
cpq × 3
streaming-api × 3
continuous-integration × 3
lightning-aura-components × 2