I have created Lightning Email Template with attachment from my local system as System Admin user. This template displayed without attachment for Partner Community Profile user. How can we share the attachment for Partner Community Profile user.


Now that you're using Lightning Templates, the attachments are uploaded as "Files" which are inserted into the "ContentDocumentLink" Object whereas previously, anything uploaded to an Email Template was inserted into the "Attachments" Object.

The difference being is that Community users can only see "Files" that were uploaded INTO that community. (i.e., when an internal user with a full SFDC license uploads a "File" Community users can't see it, even though the community users have access to view the record, AND prior to enabling Files, Community users could see Attachments that internal users uploaded.)

What you'll want to do is either use, or modify this trigger, to make the uploaded "Files" visible to Community users:

UpdateContentDocumentLinkVisibilityOnInsert on ContentDocumentLink(before insert)
   for(ContentDocumentLink l : Trigger.new)
   l.Visibility = 'AllUsers';

This trigger makes every "File" uploaded visible to Community Users. If you want to restrict visibility, modify the trigger to look for "LinkedEntityId" that begins with "00X" which is the prefix for Lightning Templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.