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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Disqualified and new leads in dynamics 365

(0) ShareShare
ReportReport
Posted on by 1,085

Hello Community Experts,

There is a requirement where, if a lead's status is disqualified and if i try to create a new lead with same email ID as that of disqualified lead, it should show an alert box or popup that "This lead already exist as disqualified" and it should not allow me to save that lead.

Kindly guide,

Best Regards,

Sumaira Noor

I have the same question (0)
  • Suggested answer
    Asif365 Profile Picture
    1,431 on at

    Hi Sumaira,

    Please try to create Duplicate Detection Rule.

    When a record is created or updated. This rule will detect duplicates when a user creates or updates a record through the mobile client, Outlook client or web client.

    In the Duplicate Detection Rule Criteria section, in the Base Record Type list, choose the type of record that this rule applies to. For example, select Contacts.

    In the Matching Record Type box, choose the type of record to compare. In most cases, you'll probably want to use the same record type for Base Record Type and Matching Record Type. It's also useful to be able to compare different record types. For example, you might want to compare the Email field in Contacts to the Email field in Leads.

    If you want the rule to consider only active records while detecting duplicates, select the Exclude inactive matching records check box. You should also select this check box if your duplicate detection rule criteria are based on a status field.

    Please have a look at below links:

    rocketcrm.co.uk/.../

    www.youtube.com/watch

  • Suggested answer
    mequan Profile Picture
    on at

    Hi Noor,

    Based on your situation I will suggest you create a duplicate detection rule to fix this issue. For more details, you may check docs.microsoft.com/.../set-up-duplicate-detection-rules-keep-data-clean .

    Thanks and Best Regards

  • Sumaira Noor Profile Picture
    1,085 on at

    Thanks a lot for the response Asif and Mequan

    The client is looking for some code to be triggered on "On save" which should throw an alert message or any pop up if the new email ID matches the email ID of disqualified leads

    Kindly guide,

    Best Regards

    Sumaira Noor

  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at
  • Sumaira Noor Profile Picture
    1,085 on at

    Thanks a lot for the response Mehdi. I'll try this now

    I was earlier trying this code I'm unable to make it work correctly

    Can i please get some help in altering this as per the requirement i mentioned?

    function compareEmailID(executionContext){

       var formContext = executionContext.getFormContext();

       var emailID=formContext.getAttribute("emailaddress1").getValue();

       Xrm.WebApi.retrieveRecord("lead", "?$select=emailaddress1&$filter=emailaddress1 eq '" + emailID + "'").then(

           function success(result) {

               if (result.length>0) {

                   Xrm.Page.ui.setFormNotification("This EmailID is exsited, please try another one!", "ERROR")

               }

           },

           function error(error) {

               Xrm.Navigation.openAlertDialog({ text: error.message });

           }

       );

    }

    Kindly Advise,

    Best Regards,

    Sumaira Noor

  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hi,

    The easiest way is to display a pop-up and clear the email when you populate the email field with a duplicate. Let me know if you need more guidance to implement this scenario.

  • Sumaira Noor Profile Picture
    1,085 on at

    Hi Mehdi,

    I would like to have the guidance on the scenario you mentioned

    Please guide,

    Best Regards,

    Sumaira Noor

  • Sumaira Noor Profile Picture
    1,085 on at

    I found solution to this using web api

    Thanks all for taking time to look into my problem

    Best Regards,

    Sumaira Noor

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans