function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
krishna Mullapudikrishna Mullapudi 

unable to fire trigger on Content Document Obj

Hi all,
I was created the trigger on contentDocument obj for after insert . But when i upoload document from UI in Dev environment the created trigger was not firiing . please help
AbhinavAbhinav (Salesforce Developers) 
Hi Krishna,

Check suggestions provided on below link:

It will help you understand the issue.

If it helps, mark it as best answer.

Lukesh KarmoreLukesh Karmore
krishna Mullapudi
I worked on this Sceneario before ,please refer below trigger If helps Please mark Best Ans So It helps other.

trigger sendEmailToContactWhenfileIsCreated on ContentDocumentLink (after insert) {
set<id> condocId=new set<id>();
    if(con.LinkedEntityId!=Null || con.LinkedEntityId!=''){
list<Messaging.singleEmailMessage> mailList= new list<Messaging.singleEmailMessage>();
list<contact> contactList=[select id,Email from contact where id in:condocId];
    for(contact c:contactList){
        list<contentVersion> covVer=[SELECT id,contentDocumentId,Title,versionData FROM contentVersion WHERE contentDocumentId=:con.contentDocumentId];
        Messaging.singleEmailMessage mail=new  Messaging.singleEmailMessage();
        list<string> toaddress=new list<string>();
        mail.setSubject('your Subject');
        mail.setPlainTextBody('This is first email attachment');
        messaging.EmailFileAttachment efa=new messaging.EmailFileAttachment();
        mail.setFileAttachments(new messaging.EmailFileAttachment[]{efa});
Thank You