![](https://trailblazers.salesforce.com/img/userprofile/default_profile_200_v2.png)
4 件の回答
Hi LFI,To cover the code for this you can create one test class and insert below code there it will cover your code...Contact objContact = new Contact(LastName='Tst');objContact.Alumni_Type__c = 'testType';objContact.Alumni_Year__c = '2002';insert objContact;Roster__c objR = new Roster__c ();objR.Program_Type__c = 'testType';objR.Program_Year__c = '2002';insert objR;P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.Thanks,SandeepSalesforce Certified Developer I got it, below is the final code:@isTest private class TriggerTestClass {static testMethod void validateTrigger() { Contact objContact = new Contact(LastName='Tst', User_ID__c='11111111'); objContact.LFI__c= 'LFI'; objContact.LFI_Year__c= '2005'; insert objContact; Roster__c objR = new Roster__c (); objR.Program_Type__c = 'LFI'; objR.Program_Year__c = '2005'; insert objR; }}Biggest thanks to Sandeep for getting me started! Hi LFI,It was too late here so I signed off for the day...Good that you were able to solve the errors....Thanks LFI!! Getting error: Error: Compile Error: Field is not writeable: Contact.Alumni_Type__c at line 6 column 5@isTest private class HelloWorldTestClass {static testMethod void validateHelloWorld() { Contact objContact = new Contact(LastName='Tst'); objContact.Alumni_Type__c= 'LFI'; objContact.Alumni_Year__c= '2002'; insert objContact; Roster__c objR = new Roster__c (); objR.Program_Type__c = 'testType'; objR.Program_Year__c = '2002'; insert objR; }}