Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Prevent duplicate connections for Contacts on custom entity

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

How can I avoid creating duplicate connections when custom entity has two lookup fields referring to two contacts lookup?

Just want to avoid creating another connection on save if connection between these two contacts already exists? Something with respect to java script is appreciated rather than plugin or workflow.

Thanks

Nikhil

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: Prevent duplicate connections for Contacts on custom entity

    Hi,

    Glad that it worked using Fetchxml and webapi.

    Please mark this thread verified so that it will be helpful for other community member.

  • Suggested answer
    Nya Profile Picture
    Nya 29,058 on at
    RE: Prevent duplicate connections for Contacts on custom entity

    Hi Nikhil,

    Great to hear that.

    Thanks for your sharing!

    This thread will be closed.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Prevent duplicate connections for Contacts on custom entity

    Hi,

    Managed to achieve object through fetchxml and webapi. Thanks all for your replies and help.

    Nikhil

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Prevent duplicate connections for Contacts on custom entity

    Thanks Nya, however it was not this I was looking for. I am very well aware of Duplicate Detection rules.

    My requirement is more or less what Bipin is coming up with.

    1) Let's say - I've X Entity with two lookups to Contact entity.

    2) I've connection already present on those contacts lookup value selected.

    3) Requirement is from X Entity if I go and select again those two contacts from lookups then find out if connection exists and if 'Yes' - hide field of 'create connection' flag or else Show the flag field.

    Thanks all but waiting...

    Nikhil

  • Nya Profile Picture
    Nya 29,058 on at
    RE: Prevent duplicate connections for Contacts on custom entity

    Hi Nikhil,

    As the JavaScript has limitations and only works on Form, it is recommended to use the Duplicate Detection, which is an OOTB feature.

    1. Enable the Duplicate detection for the connection entity first.

    pastedimage1639387032939v1.png

    2. Navigate to Advanced Settings > System > Data Management.

    pastedimage1639387116993v3.png

    3. Create a duplication detection rule for connection entity and publish it.

    pastedimage1639387247969v4.png

    4. Then when a duplicate connection is created, there will be a prompt dialog for duplicate records.

    pastedimage1639387469302v5.png

  • Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: Prevent duplicate connections for Contacts on custom entity

    Hi,

    You can easily achieve this with Fetchxml.

    CR11.PNG

    And you would need to execute this fetchxml code frm JS to check if count is zero then no connection exist.

    CR12.PNG

    You will have to replace Contact Record GUID dynamically based on your lookup values.

    Hope this helps!

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans