Skip to main content
I have a custom object Projects and I have a child object Project Documents linked to Projects. When I add a new child record (new Project Document) I want to require an attachment to the record. How do I do this?
2 respuestas
  1. 10 feb 2019, 0:37
    Attachments and Files are objects that are related to the original record, and you can't relate another object until the original record has been inserted into the database...in other words, you have to create and save the record, then attach the file.

     

    You can however do this in the after trigger, if you write an after trigger you get the ID of the record which is Project Document in your case and then do an SOQL to look for Attachments with this parentId or Files with this ContentDocumentLink.
0/9000