Not having the ability to make unique name fields for objects is an issue if you really want them to be unique. Obviously. This seemed really odd to me since every other field you can enforce uniqueness.
This issue came up for me recently on the Salesforce project that I am working on. I couldn’t easily find a way to prevent duplicates for our new custom object. We ended up creating a custom field with uniqueness enforced and then converted Name into an auto number field. New records for this object are only going to be updated by one user a few times a year (maybe), so we didn’t worry about neglecting the benefits of the Name field.
A few days later our Salesforce platform lead came back after a break and basically said WTF guys? Oh hey, there is a way by using a VLookups within a validation rule!
Id <> VLOOKUP($ObjectType.Adam_Custom_Object__c.Fields.Id, $ObjectType.Adam_Custom_Object__c.Fields.Name, Name)
This will compare the Name field that a user wants to insert with all other name fields in your custom object and return an Id records that match. If the name already exists, the matched record will have an Id. Since the matched Id won’t match the Id of the record being inserted (Id is empty at this point), the above formula will return true and will trigger an error.
If you feel like the Name field should have a unique attribute that can be set, check out this link to upvote for the idea. Also please leave a comment here if you agree or not. Since this is my second blog post, any feedback would be great!