A common problem for Salesforce users is the accidental creation of duplicate records. Validation rules are often used to check the condition of a record before it is saved. Here is a validation rule we use to prevent the creation of a new record with the same name (unfortunately it only works on custom objects).
It uses the VLOOKUP salesforce formula function which is only available for validation rules (unfortunately). This validation rule has two parts:
1) It looks for a record of the same name
2) It makes sure that the record isn't the exact same record as opposed to just a duplicate. This will happen when a record is edited, the name already exists (as itself) and when saved will trigger the part 1 result.
Here is the rule. Simply replace the object name and field name (which can both be entered automatically when using the formula editor)
and(
Name = VLOOKUP
($ObjectType.Service__c.Fields.Name , $ObjectType.Service__c.Fields.Name, Name ),
not(
Id=VLOOKUP
($ObjectType.Service__c.Fields.Id , $ObjectType.Service__c.Fields.Name, Name )))
Subscribe to:
Post Comments (Atom)
3 comments:
How can I use this approach on standard objects,do you have idea?
How I can apply this approach to standard object,I am just starting learning,do you have any idea how to iterate over specific field value but on standard object
You say (unfortunately it only works on custom objects),
How to use this solution on standard objects.
Post a Comment