The exact error message is
System.DmlException: Insert failed. First exception on row 0; first error: >CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, HealthCloudGA.AccountTrigger: execution of >BeforeInsert caused by: HealthCloudGA.MoiExceptionWrapper.ValidationException: There is >more than one Individual record type for Account or Contact. The record type must be >unique. Contact your administrator for help.
I have a simple test class (auto-generated by the DLRS package) that is attempting to create a new account to test a trigger.
We are using HealthCloud with PersonAccounts.
Many similar errors say to check the Account and Contact to ensure the Custom Metadata settings are correct. The Individual record type's settings are part of the Health Cloud package. I can't change anything with them.
Also, I attempted to make sure there was only one Individual record type, per the error message, but that is also controlled by HealthCloud and cannot be changed.
I have also checked for mandatory filters that require values (grasping at straws) and made sure to pass those in (hard-coded while hacking away to see if I can get it to work). No success.
Update - Mar 15
I have changed the code to resemble the suggestion below. The results are the same.
@IsTest
private class dlrs_AccountTest
{
@IsTest
private static void testTrigger()
{
// Force the dlrs_Physician_ReviewTrigger to be invoked, fails the test if org config or other Apex code prevents this.
Map <String,Schema.RecordTypeInfo> recordTypesadjustment = Account.sObjectType.getDescribe().getRecordTypeInfosByDeveloperName();
Id recordTypeId = recordTypesadjustment.get('Care_Management').getRecordTypeId();
Account acc = new Account(RecordTypeId=recordTypeId);
System.debug(acc);
Test.startTest();
dlrs.RollupService.testHandler(acc);
Test.stopTest();
}
}