SharePoint 2013 List - Managing Duplicate Entries based on 2 columns.

Jacob 61 Reputation points
2021-06-23T20:37:30.973+00:00

I'm trying to add some script to my list. Basically this is list is for employees to enter information as they get it completed. So a worker will have multiple entries, and for each entry they will choose from a choice column (Titled "Event"). The Event column has 8 choices that the employee will do one at a time over a few months. What I want is to be able to avoid the worker from entering the same choice twice. However, I can't just turn on "Enforce Unique values" on the Event column because each employee will be doing those same events.

I believe I need to use PreSaveAction() somehow to limit the worker from entering the same event twice, but I'm not really sure how to go about this.

Sample Data:

Worker - Event
John - Attend meeting
John - Attend health Screening
Mike - Attend meeting
Mike - Attend health Screening
Mike - Attend meeting

When Mike in this instance would try and save that last record, he should get an error message stating something along the lines of "You have already completed that Event"

Any help would be appreciated, Thanks!

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,797 questions
0 comments No comments
{count} votes

Accepted answer
  1. JoyZ 18,056 Reputation points
    2021-06-24T09:06:51.343+00:00

    @Jacob ,

    We could edit the New Form page, add a content editor web part, insert the jquery code in the attached txt file:

    108946-presaveaction.txt

    Result:
    108955-image.png

    108924-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    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.


0 additional answers

Sort by: Most helpful