• Dion Gunn
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hi all,

I've spent the majority of my day trying to find a solution for this issue and I'm having no luck. I'm still a bit of a beginner so bare with me.

I have a VisualForce page on a Communities site that is designed to list the standard Attachment object records from the community $Users related contact. This page is intended to list the Description of the attachment as well as a link to download it. I have a supporting controller that runs a Select query to retrieve the contacts attachments.

Here is a snippet from the page:
<apex:repeat var="doc" value="{!candidate.Attachments}">
                        <li>
                            <h4><apex:outputText value="{!doc.Description}"/></h4>
                            <div class="doc-h">
                            <apex:outputLink value="{!URLFOR($Action.Attachment.Download, doc.Id)}" target="_blank">
                                &nbsp;
                            </apex:outputLink>
                            </div>
                        </li>
                </apex:repeat>

This renders exactly how I would like it to render, and correctly displays the description and the link. However, if I browse to one of many of the links generated by {!URLFOR($Action.Attachment.Download, doc.Id)}, I receive an "Insufficient Privileges" error. I've tried hardcoding the URL and ID and receive the same error.

It generates a link like this: {community site}/servlet/servlet.FileDownload?retURL=%2Fcandidates%2Fapex%2FSupportingDocuments&file=00PN0000000ZZUBMA4

I would have expected that this is profile related, but it doesn't seem to be the case. This is what I've attempted to do to resolve this issue so far:
* Ensure that the community user's profiles has full RCED access to the Account and Contact objects and their fields.
* Ensured that the Site Guest User profile has full RCED access to the Account and Contact objects and their fields.
* Confirmed that share settings and OWD were set to public read/write for the Attachment objects parent (so Account and Contact).
* Read somewhere to try using the 15 digit ID rather than the 18 Digit, to no avail.
* Tried using traditional <a href="">Links</a> instead of apex:OutputLink.

Funnily enough, on the same page with the same user,  I have functionality that allows the user to upload an attachment (which creates an Attachment record against the sites related contact) and this works perfectly.

I've seen a few similar posts such as  here (https://developer.salesforce.com/forums?id=906F000000099hpIAA)  and here (https://developer.salesforce.com/forums?id=906F00000008y5hIAA) but I'm still having no luck. If anybody has experienced something like this before and knows of a possible solution (even if it seems far fetched) then I'd love to hear it!

Cheers,

Dion
Hi all,

I've spent the majority of my day trying to find a solution for this issue and I'm having no luck. I'm still a bit of a beginner so bare with me.

I have a VisualForce page on a Communities site that is designed to list the standard Attachment object records from the community $Users related contact. This page is intended to list the Description of the attachment as well as a link to download it. I have a supporting controller that runs a Select query to retrieve the contacts attachments.

Here is a snippet from the page:
<apex:repeat var="doc" value="{!candidate.Attachments}">
                        <li>
                            <h4><apex:outputText value="{!doc.Description}"/></h4>
                            <div class="doc-h">
                            <apex:outputLink value="{!URLFOR($Action.Attachment.Download, doc.Id)}" target="_blank">
                                &nbsp;
                            </apex:outputLink>
                            </div>
                        </li>
                </apex:repeat>

This renders exactly how I would like it to render, and correctly displays the description and the link. However, if I browse to one of many of the links generated by {!URLFOR($Action.Attachment.Download, doc.Id)}, I receive an "Insufficient Privileges" error. I've tried hardcoding the URL and ID and receive the same error.

It generates a link like this: {community site}/servlet/servlet.FileDownload?retURL=%2Fcandidates%2Fapex%2FSupportingDocuments&file=00PN0000000ZZUBMA4

I would have expected that this is profile related, but it doesn't seem to be the case. This is what I've attempted to do to resolve this issue so far:
* Ensure that the community user's profiles has full RCED access to the Account and Contact objects and their fields.
* Ensured that the Site Guest User profile has full RCED access to the Account and Contact objects and their fields.
* Confirmed that share settings and OWD were set to public read/write for the Attachment objects parent (so Account and Contact).
* Read somewhere to try using the 15 digit ID rather than the 18 Digit, to no avail.
* Tried using traditional <a href="">Links</a> instead of apex:OutputLink.

Funnily enough, on the same page with the same user,  I have functionality that allows the user to upload an attachment (which creates an Attachment record against the sites related contact) and this works perfectly.

I've seen a few similar posts such as  here (https://developer.salesforce.com/forums?id=906F000000099hpIAA)  and here (https://developer.salesforce.com/forums?id=906F00000008y5hIAA) but I'm still having no luck. If anybody has experienced something like this before and knows of a possible solution (even if it seems far fetched) then I'd love to hear it!

Cheers,

Dion