I must be missing something here..I have a visualforce page, that enables a user to create a Campaign - I have a pageblock/section with the Campaign Fields, including name, and Name is marked required. I click a button, and if the name field for Campaign is blank, I get this error: System.FinalException: SObject row does not allow errors
In the logs, the line before my error is a VF Page Message "You Must Enter a Value", but instead of throwing the error back to the user, the next line is: EXCEPTION_THROWN [EXTERNAL]|System.FinalException: SObject row does not allow errors
And the thing is, if I remove all code in the pagereference call in the controller, and just return null, it still gives the error, but as far as I can tell, I am not writing anything to the database?
Update - apparently, it is this line causing my issue:
newCampaign = (Campaign)Campaign.sObjectType.newSObject(null, true);
if I use the standard way:
newCampaign = new Campaign();
the page works just fine.
Is that expected behavior?