[SalesForce] Is it possible to upload files as a guest user in a community

Is it possible to upload files as a guest user in a community?

I am using a lightning web component lighting-file-upload component with a case's id as the recordId. The file upload works for authenticated users, but not for guest users.

I did some research and found the following resources, but still cannot successfully upload files as a guest user:

  1. This salesforce doc entitled Limit Files in Your Community says in a note:

NOTE By default, guest user files are blocked from being uploaded. Once developer customizations (Lightning pages, for instance) have been created, admins can change the settings to let guest users upload files. To enable, go to Setup > General Settings, and select Allow site guest users to upload files.

  1. These Salesforce release notes seem to also indicate that you can enable uploads by checking "Allow site guest users to upload files" in general settings> salesforce file settings.

After enabling this setting, I still have not been able to upload files.

Could I be missing some permissions?

Or does this checkbox/setting only work with the aura component file:upload?

Any other ideas of what is going wrong?

Thanks!

UPDATE:
For reference here is the component I am using (I set the recordId with a tracked variable that is generated after a case is created):

<lightning-file-upload
 class="slds-col"
 label="Upload File"
 name="fileUploader"
 onuploadfinished={handleUploadFinished}
 record-id={caseId}
 multiple>
 </lightning-file-upload>

Best Answer

I did a quick test and it is indeed possible to upload a file using guest user in a community. Below are further details on your specific questions.


Is it possible to upload files as a guest user in a community?

Yes.

Or does this checkbox/setting only work with the aura component file:upload?

The Org setting is applicable for LWC as well.

Could I be missing some permissions?

As you have confirmed that the Guest User Profile has access to Case object, BUT see below

Any other ideas of what is going wrong?

This is most likely your issue here. The profile permissions enable the CRUD access to Case object. But you will still need to ensure that the Case record being accessed which is defined in record-id is shared with the Guest User at least as Read Only. Unless the Guest User has access to that record, the file upload won't be successful.

Related Topic