I recently inherited a large project with lots of Apex code. I'm trying to use Salesforce DX to develop new features, but am unable to push code to a scratch org, because when I run
sfdx force:org:push, the system tells me about a bunch of errors in the codebase. Many of the errors are
Field does not exist: RecordTypeId on <whatever> when creating new objects. Here's an example from a test method:
Account a = new Account(...etc...); Contact c = new Contact(RecordTypeId = GlobalVariables.myContactTypeId, AccountId = account.Id, FirstName = 'First', LastName = 'Student'); insert student;
These lines produces the error:
Field does not exist: RecordTypeId on Contact (36:21)
I believe this test runs as part of our standard suite without fail on production, so why is this flagged as an error here? This unit test is in a file marked with API 19.0, so it's quite old, but I thought scratch orgs accounted for different API versions.