• Torcuato Tejada
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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!