I have imported an Excel spreadsheet into a SharePoint list in 2013. There are about 20 columns. I am trying to make the main column, single line text field, (not sure if that is the correct terminology) to enforce unique values. I click to index and I get an error stating that there are duplicate entries but I have visually verified using conditional formatting and there is no duplicate entries. What am I missing?

Thank you in advance with any help.

  • What do you mean, I mean I am not getting which type of column you are making as a single line of text? what is its data type? Commented Jul 14, 2015 at 6:32
  • The column contains application names, example: Adobe Acrobat X or Office 2010 or SQL 2008, etc. I want to make this application name field unique so users can't add the same applications. I have verified that the field does not have duplicates but when I enforce unique I get an error stating that are duplicate entries.
    – Zygon
    Commented Jul 14, 2015 at 11:54
  • You can add some code on sharepoint NewForm using SP2013 designer Commented Jul 14, 2015 at 12:05
  • And can achieve that you want Commented Jul 14, 2015 at 12:05

1 Answer 1

<script type="text/javascript">

    var titleItem;
    var flg=0;

 function PreSaveAction()

    titleItem = $("input[title='Title']").val();    

    //alert(" "+titleItem);     


           url: "http://sp13dev:4149/Appraisals/_api/web/lists/GetByTitle('ListName')/items?$select=Id,Title&$filter=Title eq '"+titleItem+"'" ,

            type: "GET",
            async: false,
            headers: { "Accept": "application/json; odata=verbose",  
                        "content-type": "application/json;odata=verbose", 
                        "X-RequestDigest": $("#__REQUESTDIGEST").val() },
            success: function (data) {

             // alert("WELCOME " + data.d.results.length);

                    $("#labelTitle").html("This value already exists in the list.");
                    //  alert("FLAG: "+flg);

                //  alert("FLAG: "+flg);

           error: function (error) {




            return false;

    return true;


  • PreSave Action is the inbuilt function of sharepoint in which we can write our CSOM code and can validate duplicate entries before adding them on to the list. Hence forth you have to add the labels naming "labelTitle" below your sharepoiint "Title" field, where you have to restric the duplicate entries. Commented Jul 14, 2015 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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