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
rubixtiousrubixtious 

Link to SF Content document from VF page

 

<apex:pageBlockSectionItem >

 <apex:outputPanel id="pnlRecommendedNda">

<apex:outputLabel value="Recommended NDA" for="lnkRecommendedNda" rendered="{!currentContract.NDA_In_Place__c == 'No'}" /> </apex:outputPanel>

<apex:outputPanel id="pnlRecommendedNda2" >

<apex:outputLink value="{!nda.NDALink__c}" id="lnkRecommendedNda" rendered="{!currentContract.NDA_In_Place__c == 'No'}" target="_blank">{!NdaRegionForContent}</apex:outputLink>

</apex:outputPanel>

</apex:pageBlockSectionItem>

 

private void GetNdaLink(){ string queryString; string docId; if(currentContract.Region__c == 'US' || currentContract.Region__c == 'CA' || currentContract.Region__c == 'MX') queryString = 'NDA US'; docId = [Select c.Title, c.Id From ContentVersion c where c.Title=:queryString].id; nda.Nda_Link__c = 'sfc/#version?selectedDocumentId='+docId; }

 

 

 

 

 I am trying to link out to a document in Content from a VF page.  The problem is the URL when using a URL field type turns out to be this:

https://c.cs2.visual.force.com/apex/sfc/#version?selectedDocumentId=068R0000000CeNMIA0

 

but I need this:

https://cs2.salesforce.com/sfc/#version?selectedDocumentId=068R0000000CeNMIA0

 

 

VarunCVarunC

In VF page use {!URLFOR('[your relative url value here]')}, this function converts your relative url to complete url and that complete URL is based on slaesforce domain i.e. na*.salesforce.com and not visualforce domain. This issue of yous occurs when you try to populate a relative URL which points to salesforce domain and you have used it on VF page thus rleative url is completed ased on current page url's domain value which is Visualforce domain.