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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
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 → ...
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
─── ──────────── ────────────────────────────────────────── ...
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 ...
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 ...
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 ...
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 ...
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:...
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 ...
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 ...
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(...
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 ...
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" ...
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 ...
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:...
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 "...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
salesforcedx-cli × 771salesforcedx × 539
vs-code × 100
sfdx-plugin × 70
scratch-org × 59
deployment × 56
lightning-web-components × 44
apex × 41
cli × 38
visualstudiocode × 28
metadata-api × 26
community × 24
unlocked-package × 22
force-cli × 20
managed-package × 19
sfdx-error × 16
git × 14
cicd × 14
unit-test × 13
metadata × 13
salesforcedx-cli-auth × 13
package × 11
code-coverage × 10
error × 9
jenkins × 9