question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scratch Org Feature not Enabled using Org Shape

See original GitHub issue

Summary

When using the Org Shape (beta) feature, sometimes the ContactsToMultipleAccounts feature from the source org isn’t enabled in the target scratch org.

Steps To Reproduce:

  1. Create an Org Shape from an Org that has the ContactsToMultipleAccounts Feature enabled
  2. Create a new SFDX Project and use the Org Shape in the project-scratch-def.json:
{
  "orgName": "bug-org",
  "sourceOrg": "00Dj0000000SOURCEORGID"
}
  1. Create a scratch org using the CLI: sfdx force:org:create -f config/project-scratch-def.json -a feature-bug

Expected result

When the scratch org is created, it has the ContactsToMultipleAccounts Feature enabled and allows pushing code that relies on this feature (Presence of the AccountContactRelation object exists)

Actual result

Sometimes the feature is enabled, and sometimes it isn’t. It’s not clear when it is or is not enabled in the Scratch Org. In come cases:

  • The UI and the Account.settings metadata will indicate the setting is enabled, but pushes will fail (lack of AccountContactRelation Apex class)
  • The UI and Account.settings metadata indicate the feature is NOT enabled, (pushes also fail)
  • The UI and Account.settings metadata indicate the feature is enabled, AND pushes work

We observe the issue each time when we try to push Apex code into the org that relies on the AccountContactRelation object that only exists when this feature is enabled and the push fails.

The issue seems to present itself randomly. More than half of the scratch orgs we create in this way are unusable. We only started to see this issue a few weeks ago following the Spring '21 release of SalesForce.

Additional information

SFDX CLI Version(to find the version of the CLI engine run sfdx --version): 7.85.1

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core): salesforcedx 50.15.0 (core)

OS and version: Observed on developer systems: MacOS Catalina 10.15.7, Windows 10, and CI/CD server: Alpine Linux docker image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
FabienTailloncommented, Jun 21, 2022

For anyone interested there are 2 Known Issues about it, one for Org Shape here, and a second one for Scratch Org here (because the issue is actually not limited to Org Shape).

1reaction
shetzelcommented, Jun 20, 2022

This is a known serverside issue and the appropriate team is tracking internally with W-9529783 and W-9604466. Since this is not an issue with the CLI I’m closing this issue. Feel free to contact support for anything addtional.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable Org Shape for Scratch Orgs - Salesforce Developers
As an admin, log in to the source org. From Setup, enter Org Shape in the Quick Find box, then select Org Shape....
Read more >
Org Shape - Not reflecting the apps from Prod Org
Org shape will mimic not the metadata but only your production settings, licenses, and feature! Org snapshots will also mimic metadata and ...
Read more >
How to Create a Scratch Org from a Shape Org in Salesforce
Then select “Org Shape”. In the source org, click on the switch “Enable Org Shape for Scratch Orgs (Beta)” located on the right....
Read more >
Day 8: Create Scratch Orgs using an Org's Shape - Texeï - Texei
From setup, search for the Org Shape option in the Quick Find Box and select it. · Enable Org Shape for Scratch Orgs....
Read more >
Get Started With Salesforce Scratch Orgs
In Winter '21, Salesforce released the org shape function to help capture what you need – this can be used to create the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found