We're querying ContentDocumentLink for a list of documents related to a specific object record that the user has access to, and attempting to create a link for the community user to download that document. We're finding the ContentDocument ID in ContentDocumentLink.LatestPublishedVersion.Id. The LEX link of /sfc/servlet.shepherd/version/download/{ID} works fine from the Org domain, but I am not finding an equivalent for the Community domain. The error I receive is that the "community is down for maintenance". I've tried a number of variations and mixtures of this and /lightning/r/ContentDocument/{ID}/view. Is this something that can be done in Lightning Communities?

We are building this page using Skuid (basically html in this particular case), so we are not able to use an Aura or LWC solution.

3 Answers 3


The download link on the file previewer in a community generates a link of this format.

It should work fine for your scenario with the exception of not being a best practice to hardcode it like this.

  • No dice. I still get the "Down for Maintenance" error page.
    – Jerbot
    May 2, 2019 at 19:49
  • @SuperJer Can you navigate to the file viewer in the community and see what the download links look like in your specific environment? /s/contentdocument/069{theRestOfTheContentId}
    – Mark Pond
    May 2, 2019 at 21:27
  • Hmm. I get an "Invalid Page" when navigating there in the runtime, and a "We can't load this page because it's missing some underlying data" error in the communities builder.
    – Jerbot
    May 3, 2019 at 19:59
  • Just a quick note when using this. You want to grab the URL base from your Communities page and the /sfc/servlet.shepherd/document/download/{id}?operationContext=S1 comes right after the .com
    – Joseph U.
    Jan 14, 2022 at 19:28

Salefsorce might add /s/ to your URL, making download link invalid.

When you build your URL with:


and hover your mouse over it on the page, you'll see:


but when you click on it, what you actually get is (note the /pageName/s/):


now, the correct url should look like this (the same as above, but with /s removed:


To do it, you can simply build your url in controller, using:

window.location.href + '/pageName/sfc/servlet.shepherd/document/download/{id}?operationContext=S1'

  • how to get the host URL of the contentdocument? salesforce internally redirecting from c.visualforce.com to c.documentforce.com. This is consuming extra browser connections. Nov 26, 2021 at 9:19

This one is working correctly in our community :


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .