Announcement

Collapse
No announcement yet.

Duplicate is getting created even after restricted

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Duplicate is getting created even after restricted

    Hi, I have added the formula to restrict duplicates, It shows the error after a user clicks the "Create" button in duplicate alert.

    This happens only when the same user tries to create a duplicate lead based on the phone number.

    However, if any other user is creating the same lead, it gets created successfully. How can i restrict whole duplicates?

    For eg:- User 1 created a Lead, Test 1 with 1122 phone number. They can't create it again. But User 2 can create it without any duplicate alert showing.
    Last edited by Ashif Malayil; 06-21-2024, 12:49 PM.

  • #2
    1. In Administration > Entity Manager > Lead > Edit select the Phone option for Duplicate check fields (screenshot 1).
    2. In Administration > Entity Manager > Lead > Formula > API Before Save Script, specify the following formula:​
    HTML Code:
    if (recordService\skipDuplicateCheck()) {
        recordService\throwForbidden("No duplicate check bypass allowed.");​
    }​

    Just checked on a test instance: this option works for any user. The main thing here is to use the formula in the API Before Save Script, not Before Save Custom Script.
    Attached Files
    Last edited by victor; 06-20-2024, 02:13 PM.

    Comment


    • #3
      victor First of all, thank you for your response. I have added this code in the API Before Save script only and in Entity also i have mentioned Phone as duplicate check.

      But when "User 1" tries to create duplicate record, it shows the duplicate alert and restrict the creation.

      However, when "User 2" tries to create the same record, it gets created. Even it is not showing the duplicate alert for User 2. In admin we can see both users created same record.

      Please find the attached screenshots also for the further information, help me to fix this issue.
      Last edited by Ashif Malayil; 06-21-2024, 12:45 PM.

      Comment


      • #4
        I tested this functionality on EspoCRM 8.2.5 and 8.3.0. And I can't reproduce your issue. In my tests, none of the Users can create a Lead.

        Comment


        • #5
          But I have tested on several instance, Espo 7.4.6, 8.2.5, every where duplicate is getting created, if it is different Users. if it is same User it's getting restricted.

          Comment

          Working...
          X