Open main form of the entity

Next,

choose the field and open its field properties

Next

Go to Events and Click Add in Form Libraries

Next 

Click New to Add the web resource

function phonenumber(executionContext)
{
var formContext = executionContext.getFormContext();
if (formContext !== null && formContext != ‘undefined’)
{
var jobtitle = formContext.getAttribute(“vinay_phone”).getValue();
var jobtitlecontrol = formContext.getControl(“vinay_phone”);
console.log(‘job title-‘ + jobtitle);
if (jobtitle == null)
{
formContext.ui.setFormNotification(“Job title Mandatory- Error notification.”, “ERROR”, “JobTitleMandateNotification”);
jobtitlecontrol.setNotification(“Job title Mandatory- Error notification.”, “jobtitlecontrolnotification”);
}
else
{
formContext.ui.clearFormNotification(“JobTitleMandateNotification”);
jobtitlecontrol.clearNotification(“jobtitlecontrolnotification”);
}
}
}

 

Next Save and Publish the Web Resource

Next Add it in the Event Handlers and Next Save and Publish 

Now its Working,

if the fields are null and it will show error notifications like this

After giving some data the errors will gone.