2

I have 2 columns (first name and last name) in a SharePoint custom list. I have a calculated column called "full name" just concatenates the first and last name columns.

Due to requirements, I need to be able to store the first and last names in separate columns which is why I used a calculated field for the full name so that users don't need to enter the full name a second time.

However, I need to be able to verify that a "full name" is unique to the list. Is there a way to apply a uniqueness validator on a calculated column? If not, are there any possible solutions to verify the uniqueness of a full name?

2

As per my understanding there are two solutions to this

1. Using client side scripting

In this case you should edit the new/edit form and add JavaScript which goes and check if FirstName + ' ' + LastName already exists in the list. For that you can use SPServices and then handle this validation on PreSaveAction method.

This approach will provide a good user experience.

2. Using Event Receivers

This approach require deployment into the farm. You should handle ItemAdding event and then cancel the insert in case of duplicates.

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.