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 :
Customer experience | Sales, Customer Insights,...
Answered

how to customize customer insight journey form validation error message

(2) ShareShare
ReportReport
Posted on by 2,510
Hi, I understand that the validation error message comes out of box, is there a way to override the error message, for example, I wanted to customize the below error messages
 
I have the same question (0)
  • Verified answer
    ArchitectMadhan Profile Picture
    458 on at

    To customize the validation error messages in Dynamics 365 Customer Insights - Journeys, you can override the default messages by using JavaScript. Here’s a step-by-step guide:

    1. Insert Custom JavaScript:

      • Open the form editor and switch to the HTML editor.
      • Insert your custom JavaScript at the beginning of the HTML body. This script will handle the validation and display custom error messages.
    2. Define Custom Error Messages:

      • Within the script, define your custom error messages for each field. For example:
        var errorMessages = {
            "firstname": "Please enter your first name.",
            "lastname": "Please enter your last name.",
            "emailaddress1": "Please enter a valid email address.",
            "mobilephone": "Please enter a valid phone number."
        };
        
    3. Implement Validation Logic:

      • Add validation logic to check each field and display the corresponding error message if the validation fails. For example:
        function validateForm() {
            var isValid = true;
            var fields = ["firstname", "lastname", "emailaddress1", "mobilephone"];
            
            fields.forEach(function(field) {
                var value = document.getElementById(field).value;
                if (!value) {
                    isValid = false;
                    document.getElementById(field + "Error").innerText = errorMessages[field];
                } else {
                    document.getElementById(field + "Error").innerText = "";
                }
            });
            
            return isValid;
        }
        
    4. Customize Styling (Optional):

      • You can also customize the styling of the error messages using CSS to match your form's design.
    5. Publish and Test:

      • After implementing the script, publish the form and test it to ensure the custom error messages are displayed correctly.

    This approach allows you to provide more user-friendly and specific error messages, improving the overall user experience

    If you find this solution useful, please like it and accept it as answer.
    -ArchitectMadhan

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans