web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Show error if a duplicate record is created with similar field for same company

(0) ShareShare
ReportReport
Posted on by 1,023

We have an n:n relationship between two custom entities.

For ex:  Company and Employee, If I am creating an employee under XXX Company and if he is already present in XXX then I should show an error message to the User. 

 

My requirement is to validate couple fields like Employee name, ID, Phone number (If this matches already with the same company XXX then I should this error that this information already matches)

Please let me know the different best possible ways on how I can achieve this. Any step by step approach is highly appreciated.

Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Show error if a duplicate record is created with similar field for same company

    Hi James,

    why don't you use the OOTB duplicate detection rules?

    here is a tutorial:crmbook.powerobjects.com/.../keeping-data-clean-in-microsoft-dynamics-crm

    www.powerobjects.com/.../using-duplicate-detection-rules-in-crm-2013-when-qualifying-a-lead

    and here another thread about it:

    community.dynamics.com/.../164742

  • yify Profile Picture
    1,023 on at
    RE: Show error if a duplicate record is created with similar field for same company

    Hi Guillaume,

    Correct me If I am wrong, If I have to use Duplicate detection rules, I assume below are the things that are not possible:

    1. Unable to restrict the user from saving the record

    2. My requirement is restrict the duplicates for companies specific:

    For ex: A works for X company

    B works for Z Company

    If I create duplicate "A" for X company I should not be able to  if it is already present and

    If " A" is not present in Z company , then I should be able to create.

    Let me know your thoughts.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Show error if a duplicate record is created with similar field for same company

    Hi James,

    You can create keys with those name ,I'd,phone  instead of duplicate detection rule.

    You can create keys from settings>customization >solution>entity>keys.

    This will give you error when you create with same name I'd and phone.

    Hope this will help.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Show error if a duplicate record is created with similar field for same company

    Hi James,

    1. Yes you won't be able to restrict it

    2. Then you will need to create a preCreate Plugin checking of the Employe is alredy working for this company if not it creates it

    if yes you throw an error to user saying that the record is already associated and abort the save process.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans