You need to sign in to do that
Don't have an account?

Link to a document in the Documents folder not working in VF page
I am trying to display a link on a custom VF page to a word document which has been uploaded to a folder in the Documents tab.
For some reason this is not working as expected. The link is not pointing to the document. Security is also not an issue. I am not doing something right in the VF I suppose.
Here is my controller code:
public with sharing class osv_portal_HomePageContoller { public string strDocUrl; public osv_portal_HomePageContoller() { try { List<Document> lstDocument = [Select Name from Document where Name = 'SLA-Technology' limit 1]; string strOrgId = UserInfo.getOrganizationId(); strDocUrl = '/servlet/servlet.FileDownload?file='+lstDocument[0].Id; } catch (Exception e) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error in getDocumentLogoUrl() ' + e.getMessage())); System.debug('Error: ' + e.getMessage()); } System.debug('The URL is ' + strDocUrl); ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'The URL returned is ' + strDocUrl)); }
This is my VF code:
<apex:outputLink value="{!strDocUrl}" id="theLink" styleclass="slabutton"> <span class="delete">Service Level Agreement</span> </apex:outputLink>
Thanks,
Calvin
Check your debug log to see if you can find the errors, since you will handle the error by yourself.
And make sure your SOQL query does find some document.
^^I have made these checks my friend.
The problem I think is the user type. The portal user is a High volume user. When I log in with my account(Im a system admin). I can access the document. The portal user has security to view the doucment but somehow for some reason, the link is blank for him.