77 votes
Accepted

Removing old hub org, or non-scratch org from Salesforce DX org list

It would be nice for this to be something in the actual CLI commands: the ability to clean up old orgs that are no longer needed. For the time being, you need to manually cleanup the DX configs in ...
pchittum's user avatar
  • 19.6k
67 votes

Removing old hub org, or non-scratch org from Salesforce DX org list

It looks like rather than deleting a hub org, you just call: sfdx force:auth:logout -u <hub alias> You'll get a warning about being sure you want to log out. Once you do, that hub org will no ...
Dave Lyon's user avatar
  • 781
53 votes
Accepted

SFDX Pull fails because of AppMenu/AppSwitcher

Here is a workaround for this SFDC Platform Winter19 bug Create/update .forceignore file at the root of your SFDX Project, with the following content : # List files or directories below to ignore ...
Nicolas Vuillamy's user avatar
51 votes
Accepted

Salesforce DX - how to set default devhub if I missed the -d option when connecting to devhub

You can use sf config set [email protected]. You can use the additional -g parameter if you want to set it globally. The related doc is here, in addition to using sf config set -h. You can ...
Fabien Taillon's user avatar
39 votes
Accepted

How do I get Apex code coverage statistics when using Salesforce DX & Visual Studio Code

The easiest way to be able to view test coverage is to have set the --codecoverage flag (-c for short) to retrieve code coverage when you run the test command. > sfdx force:apex:test:run -c -u ...
pchittum's user avatar
  • 19.6k
37 votes
Accepted

SFDX: Grant type not supported

The problem was that I was using the domain name instead of the plain test.salesforce.com. This doesn't work: sfdx force:auth:web:login -r https://xyz.lightning.force.com/ -a XYZ but this works: ...
smukov's user avatar
  • 5,503
32 votes

Unlocked packages vs Unmanaged packages

Unlocked Packages are more like an advanced form of Managed Packages, not Unmanaged Packages. Many of the same differences exist for Unlocked Packages and Managed Packages as compared to Unmanaged ...
sfdcfox's user avatar
  • 481k
26 votes
Accepted

How to run Apex anonymous code from Visual Studio Code

In the command palette, if you type "sfdx ex" you will be offered this if you have some Apex text selected: SFDX: Execute Anonymous Apex with Currently Selected Text or this: SFDX: Execute ...
Keith C's user avatar
  • 135k
26 votes
Accepted

Retrieve custom fields from standard objects using sfdx force:source:retrieve

This syntax was what I needed sfdx force:source:retrieve -m CustomField:Claim.CveClaim__c to retrieve my custom field CveClaim__c that I added to the (standard in FSC object) Claim. The -m ...
Keith C's user avatar
  • 135k
25 votes

sfdx is not recognized as an internal or external command

1.Verify the "Salesforce CLI" installed successfully or not Go to → C:\Program Files\Salesforce CLI\bin → Verify sfdx.exe should be availble 2.Add this path to environment variables "Path" Go To → ...
Deepika KM's user avatar
22 votes

Removing old hub org, or non-scratch org from Salesforce DX org list

D:\...>sfdx force:org:list === Orgs ALIAS USERNAME ORG ID CONNECTED STATUS ─── ──────────── ────────────────────────────────────────── ...
Daniel Ballinger's user avatar
22 votes
Accepted

SFDX 6.21.0-9db990b3c9 AND CURRENT Update - Error - sfdx no longer works

This happens to me every couple of days on a Mac. A workaround is to delete the directory /Users/xxxx/.local/share/sfdx/client and then sfdx-cli will automatically upgrade on the next command your ...
Keith C's user avatar
  • 135k
21 votes
Accepted

Authorize Org failed in VS Code

The following solution worked for me Run command prompt 𝐚𝐬 𝐚𝐝𝐦𝐢𝐧 (𝘚𝘵𝘢𝘳𝘵 > 𝘤𝘮𝘥 > 𝘙𝘪𝘨𝘩𝘵-𝘊𝘭𝘪𝘤𝘬 > 𝘙𝘶𝘯𝘈𝘴 𝘈𝘥𝘮𝘪𝘯) Run the command: 𝐧𝐞𝐭𝐬𝐭𝐚𝐭 -𝐚𝐨𝐧 CTRL+F, to search ...
Yuvraj Pentayah's user avatar
21 votes
Accepted

Run specific apex tests during "sfdx force:source:deploy"

Now with the latest sfdx update(7.21.0) you can run 'sfdx force:source:deploy' command with specific test classes. Check below command. sfdx force:source:deploy -p "./PathToMetadata" -l ...
SDK's user avatar
  • 548
21 votes
Accepted

Metadata Deploy and Push fails on Flexipage componentInstances in API 49 (Summer 20) and later

In the Summer 20 release, the componentInstances property for FlexiPage regions has been removed. These need to be replaced with itemInstances as outlined in the release notes. More details on the ...
pchittum's user avatar
  • 19.6k
19 votes

How to push code to production with Visual Studio Code & DX

As of Summer '19 (v46.0), the INVALID_OPERATION errors you were hitting are no longer an issue! force:source:deploy now works when deploying to production. See an example below: sfdx force:source:...
Brian Miller's user avatar
  • 5,132
18 votes
Accepted

sfdx Deploy to existing salesforce instance?

Well, the sfdx command that you included in your comment is the correct one to use. If you're worried about messing up your production environment, why not use sfdx to deploy to a sandbox first? Any ...
Derek F's user avatar
  • 59.3k
18 votes
Accepted

Unlocked packages vs Unmanaged packages

As for me, the most important difference is that the unlocked package uses SFDX for development. So you, as a developer, could create a package, create a new version, promote, install to org within ...
Oleksandr Berehovskyi's user avatar
18 votes
Accepted

Status 500, Internal server error when calling Apex from LWC

You are suppose to call the method like myCoolFunction({myParam:'param'}).then(result=>{ console.log(JSON.stringify(result)); }).catch(error=>{ console.log(...
User6670's user avatar
  • 2,976
17 votes
Accepted

SalesforceDX CLI "sObject type 'SourceMember' is not supported" with source pull

You are correct that you can only do a source pull from a Scratch Org. You can retrieve the source from a managed or unmanaged package. Just put everything you want to retrieve into an unmanaged ...
Zack Walton's user avatar
  • 1,596
17 votes

SFDX: Grant type not supported

@smukov is correct, don't use the lightning.force.com url. Instead find that url here for your sandbox and log in using the instance that shows in the url during Log In or in the sandbox "location" ...
Craig Gjerdingen's user avatar
16 votes

How to use "sfdx force:source:pull" with folders other than "main/default" where components are added in the scratch org?

Unfortunately, the CLI will always pull "Remote Add" metadata (ie. metadata not previously seen in any local SFDX Package Directory) into main/default/<metadata-type> inside of the ...
Vivek M. Chawla's user avatar
16 votes
Accepted

Export SOQL CLI Results to CSV

There is --resultformat on query. sfdx force:data:soql:query -q "SELECT Id,Name,Status__c FROM Property__c" --resultformat csv` I got that from the command help. See below. -> sfdx force:data:...
Amphro's user avatar
  • 603
16 votes
Accepted

SFDX cli force:source vs force:mdapi?

What is the difference between force:source vs force:mdapi? The file and directory structures are different. force:source refers to the new "source" format, while force:mdapi refers to the old "...
sfdcfox's user avatar
  • 481k
15 votes

How to install managed package using Salesforce DX CLI?

To install a First Generation Managed Package via sfdx, you do it the same way you do it with the metadata API. The command looks like this: sfdx force:mdapi:deploy -d packages The packages folder ...
sfdcfox's user avatar
  • 481k
15 votes

Can I use SalesforceDX to load data into sandboxes?

The short answer is: yes. All of the commands in the force:data command namespace work on any edition of Salesforce any org (provided API is enabled on that org). The long answer is: it depends on ...
pchittum's user avatar
  • 19.6k
15 votes
Accepted

No Option for "SFDX:Authorize an Org" command in VS Code Command Palette

Oh, I know the answer. You have to create a project first. Then and only then the other commands will become available for you Well, yeah. That's the answer. But just to make it cleaner for you. All ...
being of habits's user avatar
15 votes
Accepted

How do I reset the SFDX CLI Runtime Global Configuration Values?

I had struggled to find this for a bit as I missed the section discussing this in the docs. I realized that the answer was in the same documentation CLI Runtime Configuration Values but was not ...
Jayant Das's user avatar
  • 30.3k
15 votes

Deploy source to org fails with "No authorization information found"

I had the same issue. I restarted Vscode and after that it worked.
Jojosfdc's user avatar
  • 448
13 votes
Accepted

How to push code to production with Visual Studio Code & DX

You have two choices. First, you can use force:package commands to create an unlocked package. You can install this in production with force:package:install; it is similar to installing an AppExchange ...
sfdcfox's user avatar
  • 481k

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