List<Contract> contracts = new List<Contract> {
new Contract(
AccountId = DB.getAccountByNUID('800000004').Id,
Academic_Year__c = '2020-2022',
Is_Canceled__c = false,
StartDate = Date.newInstance(2021, 10, 10),
RecordTypeId = CPSContractUtil.getRecordTypeId('Faculty Teaching Assignment'),
//Course_Section_ID__c = getCourseSectionByName('202215-80003').id,
Type__c = 'Primary',
Status = 'Draft'
)
};
insert contracts;
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Account does not have valid appointment for Class Academic Year.: [] this error is coming.