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
jadentjadent 

Permissions for create/edit on Public Site

I have set the public access settings on a site to allow it full access to a custom object.

I have also set the field level security to visible for all fields on the custom object.

 

But when i try to insert or update a custom object i get an error "DML currently not allowed". What other settings must i set in order for a public site to create/edit custom objects?

Best Answer chosen by Admin (Salesforce Developers) 
David VPDavid VP

The typical way to get around the DML operations in a controller's constructor is to put your code in a regular method and use the 'action' attribute in the apex: page tag.

Don't know if it'll work with the external submit though ... I think the setters won't have been called yet.

 

Try it and let us know ...

All Answers

David VPDavid VP

You aren't trying to do the insert in your controller's constructor are you ? You can't do DML operations in constructors.

Can you show us the code ?

BulentBulent

one more thing to check:

if you are trying to do this via a component then you need to enable DML for the component. check the component tag attributes. 

jadentjadent

Yeah thats the problem. I was running DML ops in code that the constructor was calling.

 

What i'm trying to do have a form outside of force.com submit to the VF page. I need to take those incoming parameters and save them in an object. Since i can only run DML ops inside of actions taken on the page how would you recommend i circumvent this issue? The only thing i can think of is take the incoming params, spit them back out as hidden form fields o the VF page and then have an auto submit which resubmits the page to itself. Not a very ideal solution. Is there any other better way? Thanks!

David VPDavid VP

The typical way to get around the DML operations in a controller's constructor is to put your code in a regular method and use the 'action' attribute in the apex: page tag.

Don't know if it'll work with the external submit though ... I think the setters won't have been called yet.

 

Try it and let us know ...

This was selected as the best answer