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
Simon BairdSimon Baird 

Default field value not set creating record from custom visualforce page

Ok guys I've got a humdinger here. I have a visualforce page (Session__c) that has a controller extension to update related fields on another object (Account). On the visualforce page I also have a command button using the URLFOR syntax to create a record of another object type (Patient__c). When I reference the fields in the controller extension on the visualforce page and try to create the new record (Patient__c) it doesn't recognise the default field values i.e. checkbox ticked. When I remove these fields from the visualforce page code the field default values are recognised once more.The page is for a custom object called Session__c with an extension to update fields on Account with an apex:CommandButton to create a new Patient__c record. I can't replicate it in our sandbox environment either!

 
Ruthvik K 5Ruthvik K 5
Double check, part of your code you might using that field in your upsert/insert operation
Simon BairdSimon Baird
Thanks for the reply Ruthvik. The default field value is for the object (Patient__c) that has no reference in the controller extension (Account) or on the VisualForce code