When the standard Name field of an object is set as Text, it shows a weird behavior if left empty. It is not possible to mark it as required or non-required, but when editing a record from its standard edit page, the field is required:
No problem so far: the field is required in any case. The problem arises when it comes to insertion from code. If we insert a record from code:
CustomObject__c r = new CustomObject__c(); insert r;
... we get no error. Instead, the record is inserted with the short, 15-character Id copied into its Name field. What I would expect is an exception with the same error that we've got in the standard edit page.
This problem does not occur with custom fields: if a custom field is marked as required, it will be so both in the standard edit page and from code.
I did not find any mention to this on documentation. Is this behavior new in Spring'14? Has any of you found this same problem before?