1

I have this code:

 Guest_Planning_Worksheet__c gpw = new Guest_Planning_Worksheet__c();               
 update gpw;

When running it as the guest user profile, which assigned to our Site code, it fails on the update with 'INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY'.

The update fails, I obviously don't have Update access on the table. Looking around, I don't see a way to give the user profile UPDATE on the table.

What is the right way to approach this?

My Guest_Planning_Worksheet__c has lookup fields of type 'Opportunity', 'Account', and 'Event'.

I have looked in the Guest Planning Worksheet profile, and while there is no object wide permission for Update or Delete available, I have 'Edit' on for all the fields that are editable. (I have some formulas)

3
  • 2
    Take a look at learnexperiencecloud.com/s/article/…
    – identigral
    Commented Oct 8, 2021 at 20:25
  • This error relates to sharing, not object permissions.
    – Phil W
    Commented Oct 8, 2021 at 20:39
  • Thanks @PhilW, what sharing rules can I implement to allow a Guest user to use update?
    – Dave Smith
    Commented Oct 8, 2021 at 20:45

1 Answer 1

0

Looks like there isn't a way, according to @identigral

https://www.learnexperiencecloud.com/s/article/Guest-User-Record-Access-Development-Best-Practices.

It states:

any record modification needs for Guest Users should be addressed by executing such updates in Apex methods that reside in classes running in “without sharing” mode, coupled with encryption / decryption of resources. This approach has been deemed most secure by Salesforce.

Why on earth does Salesforce create restrictions on guest users, then tell us to just 'switch them off' for code that doesn't need them.

Thank you for the confirmation that I just have to switch off security to get this done. Can't wait until Salesforce expires and is replaced by hopefully something better!

You must log in to answer this question.

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