Change ‘The Form Could Not Be Submitted..’ Message In Dynamics 365 Portal

In my previous article, we discussed how to implement a custom JavaScript validation message. Now, let’s say we want to change the title of the validator.
implement custom javascript validation message 
To accomplish the above requirement, the first thing I tried to check was its element, using the inspect tool. This way, I can use jQuery to change this message and here is what I got from the inspect tool.
implement custom javascript validation message
You can see in the above screenshot that div has the "ValidationSummaryEntityFormControl_EntityFormView" ID so I used the following code-
  1. $('#ValidationSummaryEntityFormControl_EntityFormView').attr("aria-label","Preferred appointment cannot be submitted due to the reasons below:");   
However, I was not able to see any changes in the validation message and then, I tried to check again using inspect. I found that even though this label was changed, the validator title was same.
implement custom javascript validation message 
Next, I tried the following code in the console.
  1. $('h4.validation-header').text("Appointment preferences cannot be submitted due to the reasons below:");   
And, I was able to see changes in the validation title as well, like the following.
implement custom javascript validation message 
But when I used this code under entity form and checked, it was still showing the old title. Finally, I found that the above heading element is generated at runtime only. So, finally, I was able to do using set interval method like following,
  1. //change form validation label  
  2. setInterval(function () {  
  3.    if ($('h4.validation-header')) {  
  4.       $('h4.validation-header').text("Appointment preferences cannot be submitted due to the reasons below:");  
  5.    }  
  6. }, 1000);  
Hope it will help someone, feel free to share if you know more efficient method to implement it. 
Stay tuned for more Dynamics 365 contents !!