Naveen
I created a Web Resource, input your Jscript into it, then created an onLoad event for the form referencing the function.
After publishing, I get an undefined error prompt on form load. Here is what I used, not sure if I'm using the correct values:
function serviceWatchCheck() {
//execute the query and get the results
Xrm.WebApi.retrieveRecord("account", accountId, "?$select=cmm_servicewatch").then(function (result) {
//Show the warning message
if (data["cmm_servicewatch"] === null && data["cmm_servicewatch"]==="Yes")
{
var message = “This Account Is Under Service Watch”;
var type = “WARNING”; //INFO, WARNING, ERROR
var id = “123”; //Notification Id
var time = 5000; //Display time in milliseconds
Xrm.Page.ui.setFormNotification(message, type, id);
}
}, function (error) {
//show error message if something error occured during operation
var message = error.message;
var type = “ERROR”; //INFO, WARNING, ERROR
var id = “213”; //Notification Id
var time = 5000; //Display time in milliseconds
Xrm.Page.ui.setFormNotification(message, type, id);
});
}