I am managing my document in SF content library. I want to include a link to some documents in a VF page BUT I don't want the link to open the document preview on the Content tab. I would like the document to be downloaded when the link is clicked. This will only be available from within the organization (not a public VF page). Is there any way to achieve this?

  • is it duplicate of salesforce.stackexchange.com/questions/17515/…? – AtulRajguru9 May 27 '14 at 8:04
  • @AtulRajguru9 The "Download" link that I see for a content item in a content library is onclick="Ninja.View.isTabLink=true;Shepherd.run('document', 'downloadBegin', {id: '068i0000001ALxV', contentUrl : '', target : 'downloadIFrame', shepherdToken : 'dXDgAU4G80xvRttDcsBu3tHQUdLZAxk5LnL1pRri2VC2ewByGXKyj0W6J7slDEiGxY_pNjl0A13JI3zpfOEFWVeFRX6XQ1n7lywh.2YO6emy24Yc2PWvTgAJmlMcSNQHZCmFDgQq3D0HcCJU0LIenXi1jlA='});return false;" so does look different to normal attachments... – Keith C May 27 '14 at 8:44

You can directly download using the ContentVersion Id:

/sfc/servlet.shepherd/version/download/<CONTENT VERSION ID starting with 068>

The ContentVersion is related to the ContentDocument via a dedicated ContentDocumentId. Get the ID of the one where IsLatest is true.

enter image description here

| improve this answer | |

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.