I created a currency field on OpportunityLineItem that has a default value set to 0.00. In my test method I create a record and insert it. I then query it back out and try to assert that the field is equal to 0. It keeps coming back as null, however.
Does ‘default value’ only relate to objects created through the UI? Am I doing something wrong?
If I want to set a default value on a field do I need to do this through a trigger?
New feature coming in the next release:
Foo__c f = Foo__c.sobjecttype.newSObject( recordTypeId, // can be null true); // loadDefaultValues