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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Contact List Stop Dupl...
Power Pages
Answered

Contact List Stop Duplicate Emails (PowerApps Portal)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all-

 

Strange thing that I am facing. I am using the contact entity with a custom form that has just E-mail field, Username (same as E-mail) and First Name/Last Name.

 

When I submit a new entry and the contact E-mail is test@test.com and I submit another one with the same E-mail, it is allowing it. 

 

How can I allow it as each entry should have a unique E-mail.

 

Regards,

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,471 Most Valuable Professional on at

    You can define an alternate key in your CDS environment for the e-mail attribute: https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/administering-dynamics-365/dn949335(v=crm.8)?redirectedfrom=MSDN

     

    this is the same as a "unique key" idea

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for this. I tried the below approach and I tried actually the other option from the environment-duplicate key rule.

     

    There seems to  be a duplicate rule there but it is not doing anything when I insert. Should I be getting like a message or something?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Quick update. Strange thing: When I try to create the contact from the entity itself it detects the rule. But when I submit through the form, it doesn't trigger anything. Anything wrong I am doing here.

     

    Will using a JS function on the page help like the below- not sure but found it on the web:

     

    Contact c = new Contact();
    c.Email = "My email";
    CreateRequest req = new CreateRequest();
    req.Parameters.Add("SuppressDuplicateDetection", false);
    req.Target = c;
    try
    {
    service.Execute(req);
    }
    catch (FaultException<OrganizationServiceFault> ex)
    {
    if (ex.Detail.ErrorCode == -2147220685)
    {
    // Contact with name "My email" already exists
    }
    else
    {
    throw;
    }
    }

     

    I found this one too but not sure how to use them:

     

    POST [Organization URI]/org1/api/data/v9.0/leads HTTP/1.1
    If-None-Match: null
    OData-Version: 4.0
    OData-MaxVersion: 4.0
    Content-Type: application/json
    Accept: application/json
    MSCRM.SuppressDuplicateDetection: false

    {
    "firstname":"Monte",
    "lastname":"Orton",
    "emailaddress1":"monteorton@example.com"
    }

     
    Duplicate.PNG
  • oliver.rodrigues Profile Picture
    9,471 Most Valuable Professional on at

    as far as I know, the Portal ignores any duplication rule from your CDS, you would have to go for the alternate key to prevent that from happening

    note that the duplication rule is more like a warning, the user can still create the record

     

    another thing to note is that you won't be able to create your alternate key while having duplicate records in your system.. first modify / delete the records and then create the key

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes. You are right. the alternate key worked after removing the duplicates and recreating it!

     

    I just need to may be make the ugly message attach more friendly through JS.

     

    Thanks a lot. 

    Error on Duplicate.PNG
  • Verified answer
    oliver.rodrigues Profile Picture
    9,471 Most Valuable Professional on at

    create (if it doesn't exist) a site setting for "Site/EnableCustomPluginError" and set the value to true

    this will enable errors from plugin in your Portal

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 52

#2
Valantis Profile Picture

Valantis 46

#3
Vish WR Profile Picture

Vish WR 29

Last 30 days Overall leaderboard