Skip to main content
8 votes

Can we use NPM packages in my LWC Custom Component?

Yes, you can include the packages in lightning container and LWC Open source build. Salesforce natively does not support npm structure but most of npm packages are available as standalone .js files ...
manjit5190's user avatar
  • 8,043
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
5 votes
Accepted

Is there a way to still create a contact even if some custom fields fail?

Inserts are all or nothing, but if the only issue has to do with field lengths, you could use the AllowFieldTruncationHeader, which allows the field to store just up to the maximum length instead of ...
sfdcfox's user avatar
  • 495k
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

Is it possible to call an SFDX Plugin or command from an SFDX plugin?

sfdx commands are simply node scripts and can be required and executed: // You'll need to use the actual plugin name and path here import * as existingCommand from 'sfdx/lib/commands/force/apex/test/...
Jeff Dickey's user avatar
4 votes

Minimise delay between Streaming API and Heroku Connect

My application instantly writes to the HC PostgreSQL database, which instantly writes up to Salesforce. This is a common misconception. Heroku Connect is not a real time sync service, but rather an ...
Caleb Hearth's user avatar
4 votes

Salesforce Authentication with nodejs app

This is to prevent iFrame Clickjacking which is a common security threat. There might be a few things at play here. 1) The first thing I would check is that your site - https://mcnabb--devsanbox.cs41....
Gaurav Kheterpal's user avatar
4 votes

Is it possible to call an SFDX Plugin or command from an SFDX plugin?

Pretty old question, but still the answer might help someone in the future. I found 2 options to run other SFDX commands without messing around with CLI and child processes. Option 1: Inheritance ...
nchursin's user avatar
  • 1,001
4 votes
Accepted

Automating setup of scratch orgs

The fastest quickest setup option, in my opinion, is going to be a native command line script for your system. This is what things like bash and PowerShell have been doing really well since the dawn ...
pchittum's user avatar
  • 19.7k
4 votes

Can we use Node.js in Marketing Cloudpages?

No. You can't run Node.js in a CloudPage. On the server side, you're limited to using SFMC's implementation of Server Side JavaScript (SSJS) or AMPScript. Both languages have features to support your ...
Macca's user avatar
  • 8,256
4 votes

Node version error during Salesforce DX pre-release plugin installation

This error shows up even if you have the right node version installed in your environment. The reason why this happens is that the default Salesforce CLI installation ships with a node server bundled ...
POZ's user avatar
  • 4,409
4 votes
Accepted

this.querySelector || this.getElementsByClassName not working in LWC OSS

As described in Access Elements the Component Owns you should use the template property e.g.: const banner = this.template.querySelector('.banner.error');
Keith C's user avatar
  • 136k
3 votes
Accepted

Assets REST API - target specific BU/MID

It is not in your Asset API request that you specify it. When your integration authenticates, it does so on behalf of a user with an MID. If you want to push to a different MID you need to re-auth ...
AsinusAsinumFricat's user avatar
3 votes
Accepted

JWT Error - user hasn't approved this consumer

This was a policy issue related to Permitted Users under the Connected App, once I changed it from 'All users may self-authorize' to 'Admin approved users are pre-authorized' issue was resolved.
Json's user avatar
  • 1,637
3 votes
Accepted

How to use LWC with a Node.js application

I have got the answer, actually it was easy because the Salesforce team already provided the solution. Under the link https://lwc.dev/guide/install, when you install lwc with npx, it asks "Use custom ...
Aykut Parlak's user avatar
3 votes

Using LWC base UI components in node.js

Salesforce currently does not expose any node module to allow you to import these base components in LWC open source outside salesforce orgs. However salesforce has open sourced code for few of these ...
Mohith Shrivastava's user avatar
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

Getting SPAWN EPERM on running Authorize and Open Default Org commands

This is resolved. The issue in my case was there were certain policies that my company had set in my system that was blocking the execution of those commands.
anish samant's user avatar
3 votes

Is it possible to use LWC-related npm modules & webpack to leverage the LWC framework with Cloudflare Workers?

I'm not fully sure to understand in which context index.js is running so correct me if I'm wrong here. My guess is that the environment in which index.js is running has no knowledge of the Web APIs (...
POZ's user avatar
  • 4,409
3 votes
Accepted

How do you install a sfdx plugin with npm and package.json?

There's a workaround you can put in place to avoid the extra sfdx plugin:install step. Sadly sfdx doesn't play very nicely with the Node ecosystem so you still have to jump through a hoop to make it ...
Andy Ray's user avatar
  • 1,468
3 votes
Accepted

Is there a way to use node modules that have dependencies with Lightning Web Components?

Yes. To do so, install browserify or tinyify, and run the appropriate commands against the main module. The output will be a file suitable for including into a web browser. From there, simply follow ...
sfdcfox's user avatar
  • 495k
2 votes

Unable to get access_token from salesforce

There are several things to check: The most obvious is to make sure that your JS code has the correct values, especially the security token - that one is easy to miss, at least for me. Just ...
Jason Clark's user avatar
  • 11.9k
2 votes

Is there a way to still create a contact even if some custom fields fail?

To strictly answer your question: No. Either an insert succeeds or it does not. I don't know which features the npm package covers but describe (Apex, also available via API) information would be ...
Christian Szandor Knapp's user avatar
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

Is Marketing Cloud Custom activity save() method supported by other programming language, like Java, pathon, other than Node.js?

Custom Activities can be written in any language or framework. They are certainly not limited to Node.js. There are two options for retrieving save data. Save Endpoint Journey Builder will make a ...
Eliot Harper's user avatar
  • 16.6k
2 votes
Accepted

INVALID_SESSION_ID or No Operation Available for Metadata API

You need to use the metadataServerUrl, and you also need to use the metadata API types/namespaces when creating the session header, e.g. met_client.setEndpoint(loginResult.result.metadataServerUrl); ...
superfell's user avatar
  • 7,950
2 votes

Calling Apex REST from node/express framework

if I want to test on localhost(let's say port 3000) what should I specify for the Callback URL in the connected app? Callback URL is always where you want the access token code to be send to after ...
Jayant Das's user avatar
  • 30.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.2k
2 votes

Add subscriber REST/Node.js Marketing Cloud Email Studio

Yes you can. The following REST API method will create an email Subscriber in All Subscribers list (and also add them as a Contact in All Contacts). In the example below, "123456789" will be used as ...
Eliot Harper's user avatar
  • 16.6k
2 votes

Assets REST API - target specific BU/MID

I believe you will need to authenticate into the desired Business Unit to generate an access token before processing your request. You'll just need to specify the account_id when making that auth ...
Jason Hanshaw's user avatar

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