Find duplicates in a list

Good day,
i have a list. on creating a new item, how can i prevent creating a dublicate item in this list ?
for example to compare by phone, or email, that there is some items in list with the same phone or email, to show them and then to deny creating.

make list and library of current list ,and filter it by number/email?

Hello @ixxxl,

The easiest would be setting 'Enforce unique values' property for the column to true:
image

This way, users will not be able to save the form and will get an error message.

@mnikitina
hi, a found in manual
it works good, and i like it better. one more thing .Can i add one more field to search dynamically ? And is it search for whole list? or only in view that i selected in conection of list and library control? list is large and i want only to search only frim Status active, not status=closed

## [Filter by one field dynamically](https://plumsail.com/docs/forms-sp/designer/controls/list-or-library/caml-filter.html#id2)

You can also filter List or Library dynamically. For example, you have Search field and want to only show items where Title contains input in Search field:

fd.spRendered(function() { var dt = fd.control('SPDataTable0'); dt.ready(function() { filterDT(); }); //filter List or Library with new value when Search field changes fd.field('Search').$on('change', function() { filterDT(); }); function filterDT(){ dt.filter = "<Contains><FieldRef Name='Title'/><Value Type='Text'>" + fd.field('Search').value + "</Value></Contains>"; dt.refresh(); } });

@ixxxl,

You can filter List or Library control by multiple field. The filter applies to the selected view.

@mnikitina
When i put second field in dynamicaly filter i have an error

fd.spRendered(function() {
    var dt = fd.control('SPDataTable1');
    dt.ready(function() {
        filterDT();
    });

    //filter List or Library with new value when Search field changes
    fd.field('Title').$on('change', function() {
        filterDT();
    });
	    fd.field('telefon').$on('change', function() {
        filterDT();
    });


    function filterDT(){
	let filter = "<Or>"
	filter +=  "<Contains><FieldRef Name='Title'/><Value Type='Text'>"
            + fd.field('Title').value + "</Value></Contains>";
			filter+=   "<Contains><FieldRef Name='telefon'/><Value Type='Text'>"
            + fd.field('telefon').value + "</Value></Contains>";
        dt.filter = filter
        dt.refresh();
    }
});


@mnikitina
i found mistake i caml..
i missing the end operator

</Or>

now it works!! Thank you

1 Like

@mnikitina
good day.
items in list have their own permissions. So on creating user have access only to his items. and in this case filtering doesn't work on all list items. is it possible, for example to run filter throw whole list , like as admin see all elements?

@ixxxl,

If user don't have access to list item, they won't be able to view it.
User must have at least view permission for the item to see it in a list view.

1 Like