You need to sign in to do that
Don't have an account?
JN22
Test Class to Populate Account ID
Hello,
I have a custom object (Contract_Summary__c) that has a Master-Detail with Opportunity. I have created a test class to test a trigger and I'm trying to populate the Account Name field on my Contract_Summary__c from the Opportunity field. Can anyone give me the syntax to do this? My code from the test class is below and Line 4 is where I'm having trouble:
I have a custom object (Contract_Summary__c) that has a Master-Detail with Opportunity. I have created a test class to test a trigger and I'm trying to populate the Account Name field on my Contract_Summary__c from the Opportunity field. Can anyone give me the syntax to do this? My code from the test class is below and Line 4 is where I'm having trouble:
public static Contract_Summary__c createContSumm(Id oppId){ Contract_Summary__c ContSumm = new Contract_Summary__c(); ContSumm.Related_Opportunity__c = oppId; ContSumm.Account_Name__c = oppId.AcctId.id; ContSumm.Current_Effective_Date__c = date.newinstance(2025,1,31); ContSumm.Current_Expiration_Date__c = date.newinstance(2027,1,31); ContSumm.Type_of_Contract__c = 'Initial MSA'; ContSumm.Client_Signature_Date__c = date.newinstance(2025,1,31); return ContSumm;
Like
OR
Hope this will give you an idea to proceed.
Cheers!
All Answers
Like
OR
Hope this will give you an idea to proceed.
Cheers!