Question

Unless someone can explain what I'm missing, CRM 2013 does not have any way to check for a duplicate WHILE entering a new Lead record. I want to check for a duplicate BEFORE the new record is saved. I can't seem to figure this one out.

Basically, when a user enters the Company Name on a new Lead record, I'd like JavaScript or something check for the existence of that value in all the other Lead records and return True or False. That way I can alert the user that the Company already exists BEFORE they save the new record.

Make sense? Am I just TOTALLY missing something here?

Thanks,

Scotty

Was it helpful?

Solution

OTHER TIPS

You can use below function to check duplicate records and set alert/field value depending upon result set :

CheckDuplicate: function (someIdentifier) {
        var value = null;
        var filter = "?$select=*&$filter=(new_Identifier eq '" + someIdentifier + "') and (new_someGuidField/Id eq guid'" + Xrm.Page.getAttribute("new_someGuidField").getValue()[0].id + "')";
        retrieveMultipleSync("new_EntityNameSet", filter, function (data, textStatus, XmlHttpRequest) {
            if (data != null && data.length > 0) {
                value = data;
                }
            }, null);
        return value;
    }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top