I'm having issues with setting the dummy data as there are a lot of required fields on the system. I'm getting this error when attempting to create a dummy Marketing Source. And I apologize on the amount of questions on this one particular trigger.
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The Start Date is required: [i360__Start__c]
I get this error when trying to insert my i360__Marketing_Source__c
record.
Here is the Test code
@isTest
private class HomeDepotStoreTest {
static testMethod void TestHomeDepotStores()
{
i360__Staff__c staff = new i360__Staff__c();
staff.Name = '2036';
insert staff;
i360__Prospect__c Pros = new i360__Prospect__c();
Pros.Name ='Bob Joe';
Pros.Referral_Store__c = '2036';
Pros.i360__Phone_1__c = '(123) 123-1234';
Pros.i360__Primary_Last_Name__c = 'TESTMCTEST';
insert Pros;
i360__Marketing_Source__c source = new i360__Marketing_Source__c();
source.i360__Type__c = 'Amazon Services';
source.i360__Start__c = Date.today();
source.i360__End__c = Date.today().addYears(1);
insert source;
i360__Lead_Source__c leadsource = new i360__Lead_Source__c();
leadsource.i360__Source__c = source.Id;
leadsource.i360__Prospect__c = Pros.Id;
leadsource.i360__Taken_On__c = Date.today();
insert leadsource;
i360__Appointment__c App = new i360__Appointment__c();
App.Name = '2036';
App.i360__Prospect__c = Pros.Id;
App.i360__Lead_Source__c = leadsource.Id;
insert App;
i360__Sale__c a = new i360__Sale__c();
a.Name ='2036';
a.i360__Appointment__c = App.Id;
insert a;
}
}
Also, a side question. Is there a faster way to input this dummy data in order to get the trigger code coverage above the minimum?