JQuery script to prevent duplicate entries in SharePoint displaying as undefined

Michele DuBose 131 Reputation points


I have SharePoint Server 2016 on premise. I need to prevent duplicate values based on two columns. I've referenced this article: https://www.codeproject.com/Tips/1205585/Unique-Entries-Based-on-Multiple-Columns-in-Sharep. However, my code does not consistently work. Please refer to my code: 188165-testcode.txt

In the console.log, I can see the records returned from my list. However, it also displays, 153 undefined undefined. I assume all records are not returning and therefore showing as undefined. As a result, if I enter data in my list, the record will still save even though it already exists in the list. What's missing?

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,068 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,543 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 27,116 Reputation points Microsoft Vendor

    Hi @Michele DuBose ,
    The code in that article only works for single text type columns. You can noticle that columns(Title,Name,Email) used in the aritcle are all text type. While you are using Darte cloumn and Person column. These type columns will not work with the code.

    So, you have to change your columns to text type to use the code. Otherwise, you have to use the OOTB that permit only one column at a time to be unique.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.