You need to sign in to do that
Don't have an account?
sudha76
Trigger on Parent Object to check if the attachment is provided or not.
Hi there,
Can we create a TRIGGER on a custom object , that will make sure an attachment is provided under the notes and attachment section, before the record is saved.?
Is this possible?
thanks
This would only be possible for editing a record. You cannot have an attachment unless the parent already exists.
This class will return the number of attachments and you can process as you need
From your trigger pass in the trigger.new object from a before update trigger event.
**On the insert event call checkAttachments.isInsert = true. Then check for the checkAttachments.isInsert == false in your trigger to add error. This will prevent the insert from failing when workflows fire off the update event (if you have them)