Duplicate is getting created even after restricted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ashif Malayil
    Senior Member
    • Dec 2023
    • 171

    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.
  • victor
    Active Community Member
    • Aug 2022
    • 727

    #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

    • Ashif Malayil
      Senior Member
      • Dec 2023
      • 171

      #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

      • victor
        Active Community Member
        • Aug 2022
        • 727

        #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

        • Ashif Malayil
          Senior Member
          • Dec 2023
          • 171

          #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...