Skip to main content
26 votes
Accepted

Remove Expired Scratch Orgs From VSCode

There's no GUI for it, but you can go to the terminal and type in the following command: sfdx force:org:list --clean This will clear up all expired scratch orgs.
sfdcfox's user avatar
  • 500k
20 votes
Accepted

Query for Package Ids installed on an org?

Just run the following command: sfdx force:package:installed:list -u <alias|username> This will give you all of the packages installed, including the 04t "AllPackageVersion" Id that you need ...
sfdcfox's user avatar
  • 500k
19 votes
Accepted

Create scratch org with namespace?

In the project configuration file, specify the namespace. { "packageDirectories" : [ { "path": "force-app", "default": true} ], "namespace": "myns", "sfdcLoginUrl" : "https://login....
sfdcfox's user avatar
  • 500k
17 votes
Accepted

Scratch Org support for Person Accounts?

Ended up realizing orgPreferences are different than features. So the definition ended up looking like this: { "orgName": "Company", "edition": "Enterprise", "features": ["PersonAccounts"]...
Matthew Mitchener's user avatar
17 votes
Accepted

Create DX scratch org with caching disabled

Yes, you can disable caching in scratch org by specifying S1EncryptedStoragePref2 as disabled org preferences in your scratch org definition file. { "orgName": "DevOrg", "edition": "Developer"...
steals's user avatar
  • 1,243
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
  • 500k
15 votes

How can I determine if the org that I'm currently connected to is a scratch org?

Using the Organization object, both scratch and trial orgs have TrialExpirationDate, but we can use IsSandbox to differentiate the two. Organization org = [SELECT IsSandbox, TrialExpirationDate FROM ...
Kevin Vizcarra's user avatar
15 votes
Accepted

SFDX: Create unlocked package version - What is happening behind the scene?

I can answer some of these I think. At least we are now creating new unlocked package versions and promoting them. Our unlocked package version does depend on two managed packages. 1 - Does SF use ...
Doug's user avatar
  • 460
14 votes
Accepted

Quick way to find out when a scratch org expires?

The sfdx force:org:display command can also show the expiration date: david$ sfdx force:org:display -u test-<snipped>@example.com === Org Description KEY VALUE ─────────────── ───...
David Reed's user avatar
  • 93.4k
13 votes
Accepted

What does each OrgPreferenceSetting do?

Here are those I could find: AnalyticsSharingEnable (available in version 40.0 and later) Turn On Enhanced Folder Sharing for Reports and Dashboards (?) Use Your Salesforce Sharing Settings in Wave ...
Adrian Larson's user avatar
  • 151k
13 votes
Accepted

SFDX Pull error: Entity of type 'ListView' named XXX cannot be found

Your workaround is spot on. We had quite similar issue with pull as mentioned in this question. Also the documentation for .forceignore seems to be updated (or I may not have noticed it earlier), ...
Raul's user avatar
  • 18.9k
12 votes
Accepted

How to delete Scratch Org user from deleted scratch?

Scratch Orgs are deleted asynchronously after you run the delete command (or it expires). It will take some time for that username to be freed up, probably at least 24 hours. You'll need to use a ...
sfdcfox's user avatar
  • 500k
12 votes

How can I determine if the org that I'm currently connected to is a scratch org?

The SourceMember sObject is only present in scratch orgs. Its presence would be a sign that you are in a scratch org. The gotcha would be that it is only accessible via the Tooling API and not Apex ...
Anthony Heber's user avatar
12 votes

Can you select what release your scratch orgs are on

This feature was added in Summer '19 (release notes) In your scratch org definition file (e.g. project-scratch-def.json) { "orgName": "Example", "edition": "Enterprise", "release": "Preview" ...
Brian Low's user avatar
  • 351
11 votes

Reason: invalid_grant - expired access/refresh token

If reauthorizing doesn't help for some reasons(as I was facing) try deleting the alias as follows. It should definitely work Step 1. Go to /home/.sfdx (In windows c:\user\.sfdx) Step 2. Delete org ...
Arindam's user avatar
  • 173
11 votes
Accepted

Error when adding Role to my user in a scratch org

This is a pretty common issue with scratch orgs, particularly if your org is generated with hasSampleData: false. It comes up any time you assign one of the built-in Roles to any User and it's always ...
David Reed's user avatar
  • 93.4k
11 votes

Failed to deploy settings to scratch org

I faced the same issue, I noticed that the orgs were getting created but they haven't got linked with VSCode project. Did the below changes in my project-scratch-def.json file and it worked for me: ...
Rahul Malhotra's user avatar
10 votes
Accepted

Can .forceignore be used to not pull profiles that only exist in the scratch org?

I use this line in .forceignore for that: force-app/main/default/profiles The path should be relative to where your .forceignore lives
Denis Pereverzev's user avatar
10 votes
Accepted

Scratch Org missing from Salesforce DX org list

You are not overlooking anything but you are not understanding few concepts on how authentication works between CLI and Salesforce. The machine that creates the scratch can log into that using sfdx ...
Mohith Shrivastava's user avatar
10 votes

What is the definition of "daily" for "how many scratch orgs you can create daily"?

I wanted to know the answer to the question as asked, even though it wasn't the true issue, so I did a quick experiment. For background, my Dev Hub is a standard Developer Edition for working on ...
David Reed's user avatar
  • 93.4k
10 votes
Accepted

Access scratch org from login.salesforce.com or test.salesforce.com

This is not possible. Scratch orgs are always on test.salesforce.com, although you may also use the scratch org's Instance URL (My Domain) to initiate login. current behavior is when I create scratch ...
David Reed's user avatar
  • 93.4k
9 votes

Where can I see a list of scratch-orgs created by all the developers?

This is in the documentation: Log in to Dev Hub org as the System Administrator or as a user with the Salesforce DX permissions. From the App Launcher, select Active Scratch Orgs. A list of all ...
sfdcfox's user avatar
  • 500k
9 votes

What does each OrgPreferenceSetting do?

An up-to date way of matching the OrgPreferenceSettings list is using the Settings metadata. Using heroku/force CLI that would be: force fetch -t Settings Now you can search in the different ...
Martin's user avatar
  • 385
9 votes

How to clean my scratch org?

Scratch orgs are intended to be throw-away and have a limited life span of at most 30 days. Instead of trying to re-use a scratch org you should throw it away and build a new one.
Phil W's user avatar
  • 37.5k
8 votes
Accepted

Installing an appexchange app into a scratch org

Figured it out. You cannot use the sfdx force:package:install command using the ID of the appexchange app. The ID that is needed is eventually displayed in the URL during an interactive install of the ...
Michael Scepaniak's user avatar
8 votes
Accepted

Trying to create a shape org, but getting ERROR: No such column 'PackageDirectories' on sobject of type ScratchOrgInfo

You're probably trying to create it using your project.json. Try using a project scratch definition file. The file you're referencing sfdx-project.json should look something like this { "...
Thurton's user avatar
  • 96
8 votes

Can .forceignore be used to not pull profiles that only exist in the scratch org?

FYI, when pulling from the scratch org and not wanting to include profiles, I found that **profiles does not work, but **profile does.
PatMcClellan__c's user avatar
8 votes
Accepted

Enable Lightning Knowledge in scratch org

You need to include the enableLightningKnowledge tag in your src/settings/Knowledge.settings file. This will enable it for the org, not just the user. Notice that it is different than just enabling ...
Mike Simpson's user avatar
8 votes
Accepted

force:source:push fails with opportunity with field history enabled

This issue is now properly addressed in Salesforce DX. You need to set enableAccountHistoryTracking to true, as outlined in the Scratch Org Settings documentation: { "settings": { "...
sfdcfox's user avatar
  • 500k
8 votes
Accepted

Retrieve a change set from scratch org using sfdx?

I managed to create a change set in my scratch org and put the metadata I wanted to retrieve from the scratch org. I managed to pull that change set the same way one pulls a package: sfdx force:...
Arthlete's user avatar
  • 5,019

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