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
Arpi Jakab 8Arpi Jakab 8 

newSObject(recordTypeId, loadDefaults) ignores 'loadDefault = false'

Hi, I have a custom object that has a series of default fields. When I create a new SObject and insert it, all the default field values are assigned.

Repro:
1. Create a custom Object with a custom field of type 'checkbox' that is set to 'checked' by default
2. Create an instance of this object using [Custom Object Name].newSObject(null, false); 
3. Insert the newly created object
4. [select Checkbox__c from CustomObject]
5. Notice that checkbox is set to 'true'.

This is not limited to checkboxes, all field types have this problem, picklists, text, etc...