15

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", "orgPreferences" : { "enabled": ["S1DesktopEnabled"], "disabled": ["S1EncryptedStoragePref2"] } } Thanks René Winkelmeye for this ...


14

In the project configuration file, specify the namespace. { "packageDirectories" : [ { "path": "force-app", "default": true} ], "namespace": "myns", "sfdcLoginUrl" : "https://login.salesforce.com", "sourceApiVersion": "44.0" } This really only alluded to in the documentation, but sfdx-project.json is the key to creating a scratch org with a ...


13

Ended up realizing orgPreferences are different than features. So the definition ended up looking like this: { "orgName": "Company", "edition": "Enterprise", "features": ["PersonAccounts"] }


12

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 to install an app. Sample output: === Installed Package Versions [4] ID PACKAGE ID PACKAGE NAME NAMESPACE ...


11

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 AsyncSaveEnabled (available in version 40.0 and later) Enabling Asynchronous API ChatterEnabled Chatter Settings EnhancedEmailEnabled Considerations for ...


10

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 alone. https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_sourcemember.htm


9

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 settings metadata files for your org's preferences. For example: Accounts.settings contains the enableAccountTeams tag that would be translated ...


8

I use this line in .forceignore for that: force-app/main/default/profiles The path should be relative to where your .forceignore lives


8

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 ─────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── Access Token <snipped> Client Id ...


8

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 different user name in this case, as there's nothing you or Support can do. In the future, rename the user before deleting the org if you wish to reuse the user ...


8

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.


7

As per Enable the Dev Hub in Your Org: Enabling Dev Hub in a production or business org is completely safe and won’t cause any performance or customer issues. The Dev Hub is comprised of objects with permissions that allow admins to control the level of access available to a user and an org. and After you enable the Dev Hub, you can’t disable it. If ...


7

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 somethign like this { "orgName": "Demo Company", "edition": "Developer", "orgPreferences" : { "enabled": ["S1DesktopEnabled"] } } usually it's called project-scratch-def....


7

In addition to @sfdcfox response (which is technically accurate) , I suggest you do not try to reuse the same username in different scratch orgs, this seems a very bad habit and all your project orgs may get quickly messy, even more if you use CI. You could for example use some suffix for your scratch org usernames, using your project name and the creation ...


7

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 some internal/hidden scratch org to actually deploy package code there - to make sure that apex code and sobjects are valid? Yes, as on the reference docs "...


6

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 app into a non-scratch org (at the step where you are asked to select which users should be granted access to the app). For example, the URL for the "...


6

You should use Definition File when creating the scratch org to define its shape. Currently preparing the shape definition file is a manual step. There is a pilot program which allows you to export the shape of an org and then you can feed that shape definition when you create the scratch org.


6

Based on Denis's answer, I just went ahead and did the pull with this in .forceignore: **profiles and got this result: === Pulled Source STATE FULL NAME TYPE PROJECT PATH ─────── ──────────────────────────────────────────────── ──────────── ──────────────────────────────────────────────────────────────...


6

This is already possible: You can create a Spring '18 Enterprise Edition Pre-Release org that you'll use as your DevHub to create Spring '18 Scratch Org, as explained by the PM Rohit Mehta here.


6

After org creation you could execute anonymous Apex that sets UserPreferencesLightningExperiencePreferred = false on the User object. You could also open up the scratch org to the URL: /ltng/switcher?destination=classic And then all subsequent requests will open in Classic.


6

This has also been reported on the success community and we are currently looking into the issue. Some things to note: The CLI uses the streaming API (long polling) to be notified when the scratch org is created. If the CLI doesn't get that message, then it will not try to authenticate to the org even if it has been created. We are adding a "last-ditch ...


6

I've logged that bug with the DX team. The solution (for now) is to have an src directory in mdapi format, deploy the "history tracking" flag on the CustomObject first, and then deploy the fields afterwards. sfdx force:mdapi:deploy -d src -w 10 sfdx force:source:push Your src folder would be a traditional package: src/package.xml <Package xmlns="http:/...


6

Seemed easiest to add an Apex method to an existing class: public class UserBuilder { // Called from build code public static void ensureRole() { if (UserInfo.getUserRoleId() == null) { // Avoid "portal account owner must have a role" error UserRole ur = new UserRole(DeveloperName = 'PortalAccountOwnerRole', Name = '...


6

You apparently misread the error. You've actually reached your active limit, not the daily limit. You would need to delete at least one scratch org before creating another. They don't specify if the daily limit is reset at midnight or rolling, but in your case, it doesn't matter, you simply have too many active scratch orgs in your dev hub. It's ordinarily "...


6

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 Organization]; Boolean isScratchOrg = org.IsSandbox && org.TrialExpirationDate != null; Boolean isTrialOrg = !org.IsSandbox && org....


5

I just tried executing by create a simple file in a folder as shown in the below screenshot and below command worked fine sfdx force:data:tree:export -q data/accounts/queryFile -d data/accounts/ My folder structure is as below and you can see i have a file shown in the editor And you can see I have a file queryFile which does not have any extension . The ...


5

No, scratch orgs are always "empty" when created. They're meant to be populated with metadata from your source code repository, which is the purpose of Salesforce DX. It's not "org-based development", the way that production/sandboxes are, but instead "source code-based development", where all of your configuration is in source control, and that code is the ...


5

[ UPDATE! ] They have supposedly enabled this with a org definition file feature: https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_sfdx_scratch_orgs.htm Disclaimer: I have not been able to use this feature when I try to turn this on I get the error: ERROR: StateAndCountryPicklist is not a valid Features value. [ Original Post ] I'...


5

FYI, when pulling from the scratch org and not wanting to include profiles, I found that **profiles does not work, but **profile does.


5

You can use .forceignore to prohibit things from syncing both directions. And yes, it's because you used hasSampleData set to true, or because you enabled specific features (e.g. creating a Site). Once you ignore the files, you can then safely delete them from your repo if they're already there.


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