Announcements
Field level notification is not getting cleared using Js, if working on different tabs. If fields are under different tabs, then only able to set notification not able to clear them. Function is returning true but it not clearing the notification. Anyone facing similar issue? Thanks in Advance!!
Referring JS Syntax from: docs.microsoft.com/.../clearnotification
My final suggest changing your if logic
Try to put clear syntax of notification beginning of the function.
Hi,
Legacy rendering is already disabled and checked BR's also nothing else working on that field.
Thanks
Hi,
Is the legacy form active or disable. I suggest disable the legacy form and try it again.
Hi Necdet Saritas,
Used unique Id concept also still unable to clear the notification.
Thanks in Advance.
Hi,
You must use "uniqueId
" if you want to clear Notification.
function referral(executionContext) {
debugger;
var formContext = executionContext.getFormContext();
var jobtitle = formContext.getAttribute("jobtitle");
var birtheDate = formContext.getAttribute("birthdate").getValue();
if (jobtitle != null )
{
formContext.getControl("birtheDate").setNotification("department date cannot be earlier than the contact with police", use "uniqueId");
}
else {
formContext.getControl("birtheDate").clearNotification(); Here, you must complete with "uniqueId" Look at above link
}
}
Hi Leah Ju,
Done everything as you have suggested still it is not working. Please find below my code: Event onChange of field.
function referral(executionContext) {
debugger;
var formContext = executionContext.getFormContext();
var jobtitle = formContext.getAttribute("jobtitle");
var birtheDate = formContext.getAttribute("birthdate").getValue();
if (jobtitle != null )
{
formContext.getControl("birtheDate").setNotification("department date cannot be earlier than the contact with police");
}
else {
formContext.getControl("birtheDate").clearNotification();
}
}
Hi AdityaTripathi,
If you don’t meet the requirements of the field, it will appear notification.
Then after you change the field value, you need save the form firstly then change tab to trigger js.
If it still can’t work, you can try to clear cache or use browser privacy mode to test again.
Also, if you want, you can share your code and screenshot without personal privacy so I can help you better.
I have added the onchange events on tab and field still its not working. For clear understanding of my issue you can just Press F12 and write in Console Xrm.Page.getControl("hs_asatdate").setNotification("abc","123") and then change the tab and run this command Xrm.Page.getControl("hs_asatdate").clearNotification("123") it will return true but notification will not be cleared. If you need formcontext syntax debug a js first then you will get form context and then write in console
Hi AdityaTripathi,
I have test with following js code:
function notification(executionContext) { var formContext = executionContext.getFormContext(); var notification1 = formContext.getAttribute("new_notification1").getValue(); var notification2 = formContext.getAttribute("new_notification3").getValue(); if (notification1 != null) formContext.getControl("new_notification1").clearNotification("101"); else formContext.getControl("new_notification1").setNotification("Please enter value", "101"); if (notification2 != null) formContext.getControl("new_notification3").clearNotification("102"); else formContext.getControl("new_notification3").setNotification("Please enter value", "102"); }
And when I set event Handlers, I select fields and tab OnChange event as trigger.
In the beginning, I set OnSave event as trigger, the notification can’t be cleared though I fill the field.
So you can try to select OnChange as event as I described above.
André Arnaud de Cal...
294,060
Super User 2025 Season 1
Martin Dráb
232,858
Most Valuable Professional
nmaenpaa
101,158
Moderator