2

Back in Classic we can preview a PDF attachment by plugging in its ID into this URL:

https://DOMAIN.content.force.com/servlet/servlet.FileDownload?file=00PFILEID

Anyone know of a way to do this with Lightning Files? I saw that there is a "Share via Link" that generates an encrypted link that looks like this:

https://DOMAIN.my.salesforce.com/sfc/p/0R0STUFF/a/0R00STUFF/VwjzvENCRYPTEDSTUFFc5UbSzliMqMS6RwB1Om.arM

But this link format is encrypted. They also have a download link that looks like this:

https://DOMAIN.my.salesforce.com//sfc/servlet.shepherd/version/download/068FILEID

But that one downloads instead of opening up a preview.

What I'm looking for is a way to generate the preview URL if I have either the ContentVersionId or the ContentDocumentId on hand, without having to go through that encryption process (inserting ContentDistribution record). This will be used internally and users will be logged in at the time they preview, so there's no need for an externally available encrypted URL.

Thanks

0

You can do this using following url structure:

https://domain.my.salesforce.com/sfc/servlet.shepherd/version/renditionDownload/renditionPDF/versionId/DOCUMENT_VERSION

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.