You need to sign in to do that
Don't have an account?

Test Class coverage on Case attachment
I have a trigger that prompts the user to include an attachment before saving a case record. Can someone please help me with the test class that provides a 100% code coverage.
trigger CaseAttachment on Case (before update) { for (Case myCase : Trigger.New) { if (myCase.Status == 'Repair Confirmed') { Attachment myAttachment = new Attachment(); try { myAttachment = [Select Id, Name from Attachment where ParentId = :myCase.Id]; } catch (Exception e) { myAttachment = null; } if (myAttachment ==null) myCase.addError ('Add picture to the record'); } } }
Test Class coverage on Case attachment. This test class is 100% code coverage.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
All Answers
Test Class coverage on Case attachment. This test class is 100% code coverage.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com