function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
scott_devscott_dev 

Creating a scratch org and installing our package no longer sets the default record types for several objects.

We have a bash script that creates a scratch org, installs our base package, and then imports some sample data. For the importing of sample data, this script uses sfdx to run some Apex that inserts an Account and two custom objects that look up to that Account. 

We had been using this script for about a year, when suddenly about a month ago we started getting the error:  CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, record type missing for: Account: []

I discovered that the Default Record Type for Account was not set even though there were two record types available to the System Admin profile. If I set the Default Record Type in the that profile, and then rerun my script the error is resolved and the data imports successfully (although I needed to do the same for the two custom objects).

We don't include profiles in our package and only use permission sets, so I don't understand what could have changed and how to resolve this issue. The only workaround I have found so far is to query for the specific record types to get their ids and then set the RecordTypeId when inserting the Account and the two other custom objects. It is not a clean workaround because of a DataFactory class we use to create objects, so I'm looking for the root cause in hopes to understand why this started occuring and what I can do to fix the issue.

Any insight/assistance would be appreciated!

Torcuato TejadaTorcuato Tejada
Hello

I have the exact same issue.  Script creates scratch org and install several packages. My test methods fail when trying to create and insert an Account.

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, record type missing for: Account: []

In the System Administrator profile I can see in Record Type settings there is no default recordtype for "PT1" profile?

 
scott_devscott_dev

Found this as an existing issue: https://success.salesforce.com/issues_view?id=a1p3A0000003gB1QAI
Looks like it will be fixed shortly in a Spring 20 patch.