Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Duplicate Validation for Portal Form

Posted on by Microsoft Employee

Hi,

I am trying to add validations for a field in the web forms where it shouldn't allow email address duplication in the system. I am not sure how to add the validation. Can someone help me with this?

//Email Validator
            var emailValidator = document.createElement('span');
            emailValidator.style.display = "none";
            emailValidator.id = "emailaddressValidator";
            emailValidator.controltovalidate = "emailaddress1";
            emailValidator.errormessage = "The email you have entered is already in the system. PLease enter a different email address.";
			emailValidator.validationGroup = ""; // Set this if you have set ValidationGroup on the form
            emailValidator.initialvalue = "";
            emailValidator.evaluationfunction = function() {
                // only require email address if preferred contact method is email.
                if ($("#emailaddress1").val() == (NOT SURE HOW TO READ CRM DATA IN HERE)) {
                    return false;
                } else {
                    return true;
                }
            };

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Duplicate Validation for Portal Form

    If you could, can you help me with one more aspect of this problem

    community.dynamics.com/.../display-plugin-error-in-the-middle-of-portal-page

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Duplicate Validation for Portal Form

    Thank you very much Roohi. This was very helpful.

  • Suggested answer
    Inogic Profile Picture
    Inogic 24,094 on at
    RE: Duplicate Validation for Portal Form

    Hi Harsha,

    The ideal solution for restricting the duplicate emails in the system is to write a plugin that will run on the server-side and restricts the user if an email address already exists in the system.

    To allow plugin validation messages to be visible in the portal form, you need to create a Site Setting called: Site/EnableCustomPluginError and set the value as True.

    Hope this helps!

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans