4

I've been using this sample project & guide to test Platform Encryption with Salesforce DX. However, the example project-scratch-def.json creates a Developer org ("edition": "Developer"). As noted in this SF Help page, Platform Encryption is "Available as an add-on subscription in: Enterprise, Performance, and Unlimited Editions", but is "Available in Developer Edition at no charge for orgs created in Summer ’15 and later." So the example needs no special features enabled in its project-scratch-def.json due to the use of Developer Edition.

But I need to generate an Enterprise Scratch Org. When I do, I don't find the Platform Encryption features available in the new org. As an add-on, I expect that there's a features value I need to specify in the org def, but this page of Scratch Org Definition Configuration Values doesn't list anything that looks like Platform Encryption. So is there a missing value that will enable Platform Encryption in a scratch org?

I tried the obvious "PlatformEncryption" as features value; no joy.

2 Answers 2

3

I posted this question in the Salesforce DX Trailblazer Community. Rohit Mehta (DX Product Manager) responded, "Unfortunately, it's not supported in non-DE scratch orgs currently but it's on my roadmap. We'll try to get the feature in Winter 19."

1

Hello I found a workaround solution in your scratch org definition file you can simply add the hasSampleData attribute to true like shown below and it will create your scratch without the portals enabled. It works for both org shape and for definition file only.

{
  "orgName": "Feature Scratch Org",
  "sourceOrg": "orgId",
  "hasSampleData": "true",
  "features": ["EnableSetPasswordInApi"],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true 
    },
    "mobileSettings": {
      "enableS1EncryptedStoragePref2": false
    }
  }
}

If you want there is another work around you can also create your org with developer edition without using hasSampleData attribute. However if you need to use the enterprise edition you have to add the hasSampleData attribute to true.

If you are not using orgshape your definition file should look somewhat like this:

{   
    "orgName": "Feature Scratch Org",   
    "edition": "Enterprise",   
    "hasSampleData": "true",   
    "features": ["PlatformEncryption", "PersonAccounts"],   
    "settings": {     
        "lightningExperienceSettings": {     
            "enableS1DesktopEnabled": true, 
          "enableUsersAreLightningOnly": true    
    },     
    "platformEncryptionSettings":{       
      "enableDeterministicEncryption":true,       
      "enableEncryptFieldHistory":true,       
      "enableEncryptionSearchEnabled":true,       
      "enableEventBusEncryption":true    
    }   
  }
}   

In case you are using it in a CDCI use case you can also include your encryption settings in the file PlatformEncryption.settings-meta.xml as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEncryptionSettings xmlns="http://soap.sforce.com/2006/04/metadata">
    <enableDeterministicEncryption>true</enableDeterministicEncryption>
    <enableEncryptFieldHistory>true</enableEncryptFieldHistory>
</PlatformEncryptionSettings> 

and you can generate your tenant keys via sfdx automatically using the following commands:

  • sfdx force:data:record:create -s TenantSecret -v "Description=scratchOrgTest"

  • sfdx force:data:record:create -s TenantSecret -v "Description=scratchOrgTest Type=SearchIndex"

  • sfdx force:data:record:create -s TenantSecret -v "Description=scratchOrgTest Type=DeterministicData"

  • sfdx force:data:record:create -s TenantSecret -v "Description=scratchOrgTest Type=EventBus"

1
  • Welcome to Salesforce Stack Exchange (SFSE)! Great first contribution. Please continue to contribute. Be sure to take the SFSE Tour!
    – Moonpie
    Commented Nov 12, 2021 at 11:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .