You need to sign in to do that
Don't have an account?
CloudHugger
VF Controller Action method not allowed any DML statements
Hi All,
I have a site up, and a VF page with custom controller on that site.
The page controller accesses custom objects only, all of which are accessible to the site guest user profile. During debugging I have ALL possible permissions on.
Within the controller I have a PageReference method that attempts to upsert a record to one of these custom objects.
AUTHORIZATION REQUIRED error ARRRRHGHGHGHGHGHGH
Any suggestions re next steps? Doing my head in!
Cheers,
CH
Hi,
Pls make sure your VF page and controller are added in guest user profile and VF page in the site.
Thanks for the suggestion.
I didnt mention that I had the VF page and class available to the site guest user profile already.
- in desperation I have added access to everything to the site guest user, and STILL DML not allowed. The DML action itself is an insert to a custom object which I have given full access to the site user. I have ensured all fields are accessible to the site user profile also, and there are no validation rules - in other words, nothing in place that should stop the insert process assuming user allowed to access the object.
Incredibly frustrating! :)
I have also written 100% test coverage that runs the DML statements as a sites guest user, and all works as designed during testing. However, if I load the sites page in a different browser window I get the 'Authorisation Required' message.
Hi,
Now you need to make sure 2 things-
1. Your Object which you r using in this page is in "deployed" mode rather than "development".
2. You ar not getting any exception in this page, you can see this in debuglog available from setup--> Administator Setup--> Monitoring -> DebugLog. From here create new debuglog for site guest user.
Ever get this working? I'm trying to upsert a visitor comment to a custom object (outside the controller's constructor) and keep getting DML not allowed.
My unit test is straight forward...
And it runs perfectly.
I think the problem has something to do with guest user permissions. If I were attempting the DML inside the constructor the unit test would also fail.