Share the file to external User
Requirement: Once the file is uploaded by the internal user then it will be shared the external user (Portal User) Solution Write a trigger on the contentDocumentLink object once the file uploaded share the file to the external user public without sharing class ContentDocumentLinkTriggerHandler { public static final String ALL_USERS_SHARING = 'AllUsers'; public void runTrigger(){ // Method will be called to handle After Insert ContentDocumentLink if(Trigger.isAfter && Trigger.isInsert) { onAfterInsert((list<ContentDocumentLink>)trigger.new,(map<id,ContentDocumentLink>) trigger.newMap); } // Method will be called to handle After Update ContentDocumentLink if(Trigger.isAfter && Trigger.isUpdate) { onAfterUpdate((list<ContentDocumentLink>)trigger.new,(map<id,ContentDocumentLink>) trigger.newMap); } // Method will be called to handle After Update ContentDocumentLink if(Trigger.isAfter &am