You need to sign in to do that
Don't have an account?

How do I make my account name unique?
Hi,
According to help if i want to make my account name unique i need to make sure my syntax is "name" in validation rules. But it doesnt seems to work as validation rules will only return true/false. Did I make any mistake? Please help me.
Thanks


Hi,
I tested EricB solutions and it works...
Thanks alot
All Answers
Name<>Account_Unique_Name__c
(or whatever it is you named your unique name field)
This would return true if the name were different than your field, which would generate an error, which is what you want.
You could also do this with an Apex trigger if you'd like.
hi werewolf,
If i want to make my standard Account Name unique, how should I do it? Since we cant change standard field into unique.
Can you teach me the easiest way to do it? I have no idea on how to create a apex trigger.
Thanks & Regards
Kun
You should use a workflow field update formula instead of a validation rule to copy the value of "Account Name" into "Account Name Copy" every time a record is created or updated.
I would also recommend that you turn off the Required attribute of the custom field and do not display it on page layouts. There's no reason for your users to see this field.
The last step is that you need to populate the Account Name Copy field for all of your existing account records. You can do this via the Excel Connector or Data Loader.
Hope this helps,
Eric
But wait -- that doesn't sound right. The workflow field update will only run if it validates correctly. Let's say you have an existing account called "Smith," and so Unique_Account__c for that account also contains "Smith."
Now you make a new account and also set its name to Smith. It will save just fine, but when the workflow field update runs, it will violate the uniqueness constraint, which will negate that workflow field update, and it won't commit. Therefore you'll have one account where Name="Smith" and Unique_Account__c="Smith" and another account where Name="Smith" and Unique_Account__c="". So you still have a duplicate account name, no?
Give it a try. The unique constraint error appears at the top of the page with a hyperlink to the other record with the same name.
Hi,
I tested EricB solutions and it works...
Thanks alot
AND(VLOOKUP($ObjectType.Account.Fields.Name, $ObjectType.Account.Fields.Name , Name) = Name , OR(ISNEW(),ISCHANGED(Name)) )
Error: Field $ObjectType.Account.Fields.Name does not exist.