Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dynamics 365 Online - Field Notification on DateTime field clear not working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I have issue with Dynamics 365 ( Version 1612 (8.2.1.271) ), with javascript Field Notification.
On Form I have DateTime field called "new_test" in javascript on FormLoad I'm adding Field Notification, and adding OnChange event on that field. On Event I try to clearnotification but it's not cleared. Problem dosent occur in other Field Type like string, number etc.

Script:

function OnLoad(){

var fieldAttribute = Xrm.Page.getControl('new_test').getAttribute();
Xrm.Page.getControl('new_test').setNotification('req', '101');
fieldAttribute.addOnChange(OnChange);

}
function OnChange(context){

Xrm.Page.getControl('new_test').clearNotification('101');

}

I traied test clearNotification(..) and clearNotifications()

In additional if user set value on field with some random string like "aaa", and after that choose date from date picker, notification is cleared.

 Problem occurs on Trial version and on client sandbox with installed update to 365.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    I have the same Issue right now(( Is anybody found solution?

  • pratiksoni Profile Picture
    pratiksoni 30 on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    Yeah, I'm facing the same issue on DateTime field.

    Tried to apply the notification ID and then clearing it by the name and the other way mentioned above, but nothing's working for certain reasons.

    if (birthDate > currentDate) {
        fields.birthDate.controls.forEach(function (control) {
            control.setNotification("Birthdate can only be less than or equal to TODAY's date.", notificationId);
        });
    }
    else {
        fields.birthDate.controls.forEach(function (control) {
            control.clearNotification(notificationId);
        });
    }

    Also, the same code is working in unmanaged solution, but when I exported it to managed solution, it is NOT removing the error notification.

    Anyone is able to resolve this issue? 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    I too have a similar issue but with look up field. Used the code with no success

    any one facing the same issue? is there a way we can find the unique id for this field

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    no error in javascript etc. only notification is still visible and user cannot save form.

    Like you pointed legacy forms are problems here. When I changed rendering form to new TurboForms everything started to work.

    Seems like legacy forms have bug with DateTime FieldNotification after 8.2.x update.

    Thanks for help.

  • Verified answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    Is there an error or is it just that the notification is not cleared? If it's the latter, disable legacy forms..

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    Error still occurs even if I use Xrm.Page.getControl('new_test').clearNotification(); or Xrm.Page.getControl('new_test').clearNotifications();

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,076 on at
    RE: Dynamics 365 Online - Field Notification on DateTime field clear not working

    Hi,

    Please try using the code below. The clearNotification method doesn't need any parameters.

    Xrm.Page.getControl('new_test').clearNotification();

    See: dynamicsofdynamicscrm.com/.../set-form-and-field-notifications-crm-2013-javascript-new-feature/

    Hope this helps.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans