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
Swati TaunkSwati Taunk 

attachments linked to custom object not visible to community users

Hello,

I have created a mobile community app on angular JS and VF. Community users are logged in by SSO. There is a custom object with notes & attachment related list.
Community users are not able to view images from attachment object.  [ <img src="<SiteURL>/servlet/servlet.FileDownload?file=attachmentID" /> ]

Any idea why attachments are not visible to community users?
 
Sagar PareekSagar Pareek
In VF markup, you generate the link using URLFOR() and the $Action global variable rather than hardcoding the path to the servlet. <apex:outputLink value="{!URLFOR($Action.Attachment.Download, yourAttachment.id)}">

Reference 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_action.htm
Swati TaunkSwati Taunk
Hi Sagar,

I want to show the image and not download link. I tried with link also - <apex:outputLink value="{!URLFOR($Action.Attachment.Download, yourAttachment.id)}"> but its not working.
When I click on the link, it says "Insufficient Privileges". Do we have to explicitly provide any permissions for attachment to custom objects?
I am able to view attachments when I view Site as Site Guest User but not when logged in as community user.