I have a custom field on which i want to Capture the Serial number of an Asset. Now I want to have a validation rule on this field so that it eliminates duplicate values on this field. So that means no two records in this object should have the same serial number.

There are already records on this object. so can i have a validation rule for this issue?

  • This cannot be achieved through validation rule.Write a trigger to achieve this – Samir Mar 8 '17 at 15:59
  • 1
    Why not the standard asset Serial Number field? – sfdcfox Mar 8 '17 at 16:15
  • I have a trigger to automate the behavior of this object. All i wanted to know is if there is a way to achieve this task by using a validation rule or do i need to add this piece also in to the trigger? – Avinash babu Mar 8 '17 at 18:12

Admins often do this using a workflow field update to a text field marked as unique.

This can be set as case sensitive or not depending on your use case.

See https://help.salesforce.com/articleView?id=custom_field_attributes.htm&language=en&type=0 for the unique field attribute.

Triggers are better as they let you present a proper error message to the user. Using the workflow rule hack just shows an error that says something along the lines of "this record failed to trigger a workflow field update"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.