I created a custom object Project__c. I haven't added any custom fields to it yet. I have noticed something strange trying to insert new Project__c instance. I wrote this code:

Project__c newProject= new Project__c();
insert newProject;

and executed it. As a result I got new record with Project Name: a0D58000001JeqC. How is this possible? I was expecting error, because standard field Project Name is required.

  • Probably a convenience feature (not sure its documented) but I've noticed it too when writing unit tests.
    – Keith C
    Sep 2, 2016 at 19:47
  • I've seen it when doing data loads too where I don't care to export the name. You also see it all the time on change sets if anyone deploys using migration tools. I couldn't find any documentation of it either after a cursory search.
    – Adrian Larson
    Sep 2, 2016 at 19:49
  • Does it mean I have to add validation rule to check if field Name is empty before insert?
    – Hey Joe
    Sep 2, 2016 at 19:50

1 Answer 1


If you don't give a name through code, it defaults take it's ID.

The UI will require a user to input a String, but why does the code really need to force it to? The developer is the one creating the code and so then knows what should be acceptable.

For reference:Standard field not throwing an error

Thanks dphil for nice explanation.

Not the answer you're looking for? Browse other questions tagged .