You need to sign in to do that
Don't have an account?
Oksana Dovbak
Apex Class Test for Attachment Trigger
Hello,
I'm trying to create an apex class to use in testing an attachment trigger I created below -
Could you please advise me on the apex class needed to make sure this satisfies the code coverage?
I'm trying to create an apex class to use in testing an attachment trigger I created below -
//Trigger to update the Send_Attachment_Email__c custom checkbox field on Opportunity if it has an attachment. trigger attachmentTrigger on Attachment (after insert) { list<Opportunity> o = [select id, Send_Attachment_Email__c, StageName from Opportunity where id =: Trigger.New[0].ParentId] ; if(o.size()>0 ) { o[0].Send_Attachment_Email__c = true; update o; } }
Could you please advise me on the apex class needed to make sure this satisfies the code coverage?
Let me inform if it helps you and kindly mark it best answer if it helps you
thanks
All Answers
Here is the sample Code. Please try it out and let me know.
Let me inform if it helps you and kindly mark it best answer if it helps you
thanks