Skip to main content

We have uploaded one excel file in my sandbox and want it to be downloadable by community users. We are using Customer Community license and have a custom profile for our community. I have a LWC on one of my community pages and I am trying to query the Id of the ContentDocument record for that file. The file is located in Asset folder. Below is the link that I am generating in my JS based on the Content Document Id.

this.templateFileURL = `/sfc/servlet.shepherd/document/download/${idOfDocument}`;

I am using the url generated above in the 'href' attribute of 'a' tag in html. Whenever I am trying to download the file by logging in as a community user, I get the below message.

top.location='https://my-org-instance.sandbox.my.site.com/ex/errorduringprocessing.jsp'

I am not able to figure out what this error means and the strange thing is while querying for the ContentDocument in my apex, if I am using Title of the document in my WHERE clause then no document is found and if I query based on Id of the document then I can see the document being found but I end up getting the above error in community. This is very confusing because if the file is not accessible to community user because of any missing permissions, then it should not be found even when using Id in my query?

 

Also, I am not able to share the file with the community user in Share option on the file as the list doesn't show community user when I search for it. I have checked for all the permissions that I could find and I am not able to figure out the issue here. Can someone please tell if they know the work-around here & what is the exact way to query for content document also as I can not query it based on Id? Any help is much appreciated.

 

@* Experience Cloud *

3 件の回答
  1. Tom Bassett (Vera Solutions) Forum Ambassador
    2022年12月19日 18:08

    Hello,

     

    I would suggest storing this as a static resource which would make accessing the file easier when accessing via a Experience Cloud Site

0/9000