I know there is possibility to turn on this feature using Scratch Org config file.

"orgName": "Scratch1",
"language": "en_US",
"edition": "Enterprise",
"features": ["Entitlements","MultiCurrency", "API", "AuthorApex", "ContactsToMultipleAccounts", "ProcessBuilder", "StateAndCountryPicklist", "DeferSharingCalc"],
"settings": { 
        "translation": true,
        "chatterEnabled" : true,
        "disableParallelApexTesting" : true,
        "pathAssistantsEnabled" : true,
        "notesReservedPref01" : true
    "orderSettings": { 
        "enableOrders": true
    "accountSettings": {
        "enableAccountTeams": true
    "opportunitySettings": {
        "enableOpportunityTeam": true
    "quoteSettings": {
        "enableQuote": true


issue is this does not work for me and all my new orgs automatically try to recalculate sharing on sfdx push - and it fail. Was anyone able to create scratch with this function enabled? I can't see what I am doing wrong... I will appreciate any help! :)

  • Do you see the "Defer Sharing Calculations" in the setup menus after creating a scratch org with DeferSharingCalc? I don't Jul 9, 2019 at 1:43
  • Hi @DanielBallinger, in fact I can see it setup. Issue is both (Sharing and group) calculations are enabled and I don't have any option to disable it... Jul 9, 2019 at 5:38
  • I did not tried it yet... Still it feels like cheap shot and may potentially cause some issues for development (difference in editions etc...). Anyway, it is not solution but still - something I can try :) Jul 9, 2019 at 8:30
  • I think it’s uncool to open a bounty and then not respond to answers. I see no reason why you don’t select my answer as the answer? Jul 15, 2019 at 16:37

4 Answers 4


DeferSharingCalc is first step to enable Defer Sharing Calculations feature in scratch orgs. For using this feature, User should have Manage Users AND Manage Sharing Calculation Deferral permissions. Create a permission set with these permissions and assign it to user, then you will be able to use this feature in scratch orgs.


According to Salesforce this is a somewhat cumbersome two way step where using this org feature needs to be accompanied with a second manual step:

Enabling the Defer Sharing Rule Calculation feature typically requires two steps - contacting Salesforce support and then enabling the feature in the UI (https://help.salesforce.com/articleView?id=security_sharing_rule_recalculation.htm&type=5). It appears that the scratch feature "DeferSharingRecalc" is helping with the first step but it requires the user to provision the appropriate permission and then Suspend, Resume or Recalculate sharing rules in the UI.

See github issues


You can use sfdx-hardis command sfdx hardis:scratch:create

If it detects DeferSharingCalc in sfdx-project.json, it:

  • Generates a Permission set and uploads it to the scratch org using mdapi:deploy
  • Assigns the scratch org user to this PS
  • Suspend the sharing calculation using sfdx texei:sharingcalc:suspend
  • Performs force:source:push
  • Resumes the sharing calculation using sfdx texei:sharingcalc:resume

Note: this behavior is also available with UI in Visual Studio Code SFDX-Hardis extension within commands:

  • Start a new task
  • Create scratch org (or resume)
  • Create scratch org (force new)

enter image description here


As others have said, the DeferSharingCalc feature needs to be followed up with assigning the User the Manage Sharing Calculation Deferral permission and then a final step for the sharing rule calculations to be suspended or resumed/recalculated.

But the final step is now a deployable change using the deferSharingrules field in SharingSettings metadata: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingsettings.htm

You must log in to answer this question.

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