1

Can anybody help me in solving my error i want to make a field unique by validation rule but i am getting following error.

Formula:

   AND(CONTAINS(VLOOKUP($ObjectType.Account.Fields.Name , 
$ObjectType.Account.Fields.Name, Name), Name), OR(ISNEW(), ISCHANGED(Name)))

Error: Field $ObjectType.Account.Fields.Name does not exist. Check spelling.

Thanks in advance.

1
  • 1
    Where are you writing this validation rule? On Account?
    – manjit5190
    Jan 4, 2017 at 11:07

2 Answers 2

2

This answer troubles me, because it does not answer the question you have actually posed, but provides the solution you have illuded to wanting in the post.

To enforce unique Account Names these days, you should probably consider using Matching Rules and the Platform standard Deduplication engine? You can create a Matching Rule that simple asserts the Account Name is unique:

Account Name Matching Rule

And then have a Deduplication rule that throws an error if that Matching Rule is fired?

The old school way used to be to create a custom field with "Unique" enforced on it, and then a workflow rule which updated that field whenever an Account was created or updated and that would fire a standard error if you tried to create a non-unique account name.

There is no real way to do that with a Validation rule otherwise.

2
  • Great explanation and nice approach with Matching & Duplicate Rules. Thank you! May 21, 2017 at 10:33
  • I also tried to solve this via a validation rule but this is a much better approach even though it's a little bit more complicated.
    – Semmel
    May 24, 2021 at 0:30
1

Vlookup is only available for custom objects as of now. You can vote for this idea. The workaround might be using a trigger or may be a flow (not sure if flow will work 100%)

3

You must log in to answer this question.

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