function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eng CherylEng Cheryl 

Public site with Flow embedded in Lightning runtime not saving a record

Hi all,

I have public site with Visualforce Page. Basically, this is a public site for guest users to fill in a form without having to log into Salesforce. After completion of the form, the form information is saved as an object record in Salesforce.

When running the site in preview mode, the record is successfully saved in Salesforce. However, when running the actual site, the record is not saved and there is no debug logs.

A flow that is performing the saving of record is embedded in the Visualforce page and will run in Lightning Runtime.
VisualforcePage_EmbeddedFlow

I have also performed below configurations:
1. In Site Details > Public Access Settings > Object Settings: Read, Create, Edit permissions have been enabled for guest user profile. Field permissions have also been enabled.
ObjectSettings_ObjectPermissions
2. In Site Details > Public Access Settings > Custom Settings Definitions: GW_Volunteers.Volunteers Settings custom settings have been added.
- In Volunteers Settings custom settings, Grant Guest Users Update Access is checked.
VolunteerSettings
3. In Site Details > Public Access Settings > System Permissions: I have also enabled API Enabled, Modify Data Classification and Run Flows permissions
SystemPermissions
However, the record is still not saved when I run and complete the form on the actual public site. A record is only saved when the preview site is run.
Is there any other additional configurations I would need to enable/ perform for the saving of record to work?
Also, is there a way to add debug logs for this public site so there would be a clearer indication of the error?
Thanks.
ShirishaShirisha (Salesforce Developers) 
Hi Eng,

Greetings!

Have you checked the Org wide defaults for the Objects on which you are trying to save the record.If not yet,please check the external access for that Object to see,if it is private.

If yes,I would suggest you to try by changing it to Public Read/write since we are trying to create the record as an External user on the site.

Also,I would suggest you to capture the debug logs on Guest User if you haven't tried this before to see,if you get any other errors related to the access level.

Please refer the article (https://help.salesforce.com/apex/HTViewHelpDoc?id=code_add_users_debug_log.htm&language=en_us) to capture the debug logs on guest users.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
ccazzccazz
Hi Cheryl,

Based on the date of this article, I am wondering if this might be related to the changes to the Site Guest User (Profile) originally scheduled for Spring'20, but pushed back to Summer'20?

https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_networks_guest_user.htm
 
Guest users are not allowed to have write access to anything anymore...and sharing is limited.
In order to grant them write access and/or remove sharing concerns you would need to run the code/automations (I use flows to do something very much like what you are describing) in System Context without Sharing - Access all records.

Here is a pretty good breakdown of what that change impacts with links to additional resources on a more technical level:

https://katiekodes.com/salesforce-spring-20-guest-user/

Let me know if this helps, if you figure it out or have any other questions!

Good Luck!
ccazzccazz
One thing I forgot to mention, I think that when you test in preview mode, it uses your user's profile/permissions/sharing etc.