PeopleCode Events: FieldDefault

FieldDefault PeopleCode Event
From within PeopleCode, if you want to set the default value (that is the value that is displayed initially) for a field then this is the PeopleCode Event in which you need to write the required code.

However, this event is not triggered always.

For FieldDefault to trigger, two conditions need to be satisfied:
One is having some PeopleCode written in this event.
Second one is that, the page field should have no value even after applying default values (if any) specified in the record field properties. A point to note is that, the page field is consider blank if a zero is specified as default for a numeric field or a null is specified.

Default values set using FieldDefault does not mark the row as changed and such rows are not written back to the database during save.

Another point to note is that the you can’t issue an Error or a Warning from within this event. This would cause a runtime error.

FieldDefault PeopleCode can be associated with record fields and component record fields.

Leave a Reply

Your email address will not be published. Required fields are marked *