Duplicate checking fields - V8.0
Collapse
X
-
AFAK you should be able to keep your custom duplicatecheck class as it is and should work even with latest version v8 and above, i am using a custom duplicate check for few entities in different projects and it works fine. here is a discussion with yuri about it https://github.com/espocrm/espocrm/i...ent-1628924603 -
Hi, until now I used a custom duplicate check, which would be obsolete with the new function. With the above script it works.
Will I have to delete the scripts I used before version 8?
And is it possible to have a duplicate check depending on two fields at once?
I have an entity, where I organize exhibitions. Every exhibition has items, which are numbered from 1 to n. So one exhibition may have item 1 to 10, the other one 1 to 15. As it is checked now, I get a duplicate warning, when I place the number 1 in a new exhibition, when there is already a number 1 in a former exhibition.
So it would be necessary to have something like: If in exhibition X there is a number 1, it cannot have another number 1 (duplicate check warning). If in exhibition X there is a number 1, it may have a number 1 in exhibition Y (no duplicate check warning).Last edited by shalmaxb; 10-22-2023, 02:22 PM. -
But if you want to force the user to not create the entity when a duplicate is found, you need to add the code mentioned by Yuri above
PHP Code:if (recordService\skipDuplicateCheck()) {
recordService\throwForbidden("No duplicate check bypass allowed.");
}
Leave a comment:
-
But if you want to force the user to not create the entity when a duplicate is found, you need to add the code mentioned by Yuri above
PHP Code:if (recordService\skipDuplicateCheck()) {
recordService\throwForbidden("No duplicate check bypass allowed.");
}
Leave a comment:
-
-
To forbid bypass duplicate checking, one can use
Code:if (recordService\skipDuplicateCheck()) { recordService\throwForbidden("No duplicate check bypass allowed."); }
Leave a comment:
-
you are welcome Make sure to change Account with your entity. if you face any issues let me knowLeave a comment:
-
you will a code like this, add it to your entity administration > Entity Manager > Your Entity > Formula > API Before Save Script and use the code below
PHP Code:if (!recordService\skipDuplicateCheck()) {
$id = record\findOne('Account', null, null, 'name=', name);
if ($id) {
recordService\throwDuplicateConflict($id);
}
}
Leave a comment:
-
you will a code like this, add it to your entity administration > Entity Manager > Your Entity > Formula > API Before Save Script and use the code below
PHP Code:if (!recordService\skipDuplicateCheck()) {
$id = record\findOne('Account', null, null, 'name=', name);
if ($id) {
recordService\throwDuplicateConflict($id);
}
}
Leave a comment:
-
Understood thanks, sadly that is outside my scope of understanding in the world of code & Scripting, So I'm going to ask the most annoying question, how do I do that?Leave a comment:
-
It will only do a Duplicate Check, it won't prevent from creating duplicate. You can use Before Save Formula to deny all duplicate creationLeave a comment:
-
Duplicate checking fields - V8.0
I have upgraded to V8.0.0.0 today as I saw the duplicate check is now available. I have selected the fields that should be checked for duplicate, however I seem to be still missing something as I can stil create duplicate entries.
To give a background, I am using the default name field as my serial number field, as such this needs to be a unique field and can't be duplicate.
Is there something I need to change in the backend to prevent users from being able to update/create duplicate entries?Tags: None
Leave a comment: