web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

(0) ShareShare
ReportReport
Posted on by 256

Hi All,

I am using    Xrm.Page.getControl("fieldname").setNotification("Invalid");  for show the error notification on field in JavaScript. It is working fine.

But Xrm.Page.getControl("cyno_startdate").clearNotification() is not working for clear notification in Dynamics 365. 

If, I am using this alert(Xrm.Page.getControl("cyno_startdate").setNotification("Invalid Start Date")). Its return false.

Please suggest any solution ASAP.

Thanks! 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Pratices  Profile Picture
    5 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Hi Ankit,

    I had one scenario that one you give more then 10-digit phone numbers it will give the warning even you are giving any alpha value as well.

    pastedimage1670990008919v1.png 

    pastedimage1670990091179v2.png

    Code: https://juniorcrmblog.blogspot.com/2022/12/how-to-make-field-only-take-10-digit.html

    In this code i have use setFieldNotification.

    Note : I have latest dynamic crm interview question.

    https://juniorcrmblog.blogspot.com/2021/08/ms-dynamic-crm-interview-question-for-2.html

    And This day I do video on dynamic DCRM.

    Call workflow directly from a button using Ribbon Workbench - YouTube

  • Community Member Profile Picture
    on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    You really shouldn't be running with any code not working in turbo forms in 365. Who knows when the option to run legacy form will go away...

  • Suggested answer
    Syed Ibrahim Profile Picture
    6,257 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Can you try this below method. Which is working fine for  me. Make sure u enabled legacy form rendering as well.

    function commonEventHandler(executionContext) {
    var entityObject = executionContext.getFormContext().data.entity;
    var telephoneAttr = entityObject.attributes.getByName('telephone1');
    var isNumberWithCountryCode = telephoneAttr.getValue().substring(0, 1) === '+';

    // telephoneField will be an Xrm.Page control if invoked from a form OnChange event;
    // telephoneField will be a editable grid GridCell object if invoked from editable grid OnChange event.
    var telephoneField = telephoneAttr.controls.getByIndex(0);

    if (!isNumberWithCountryCode) {
    telephoneField.setNotification('Please include the country code beginning with ‘+’.', ' ');
    }
    else {
    telephoneField.clearNotification('countryCodeNotification');
    }
    }

    scriptss.PNG

  • JokiJani Profile Picture
    25 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    It's a pug with Legacy form rendering. I Don't know any workaround.

  • HenriquePalomo Profile Picture
    510 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Hello.

    Please use:

    Xrm.Page.getControl(arg).clearNotification(uniqueId);


    https://msdn.microsoft.com/en-us/library/gg334266.aspx#BKMK_clearnotification

    Regards.

  • AnkitSinghal Profile Picture
    256 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    No. I used another solution for this now.

  • Mclare Profile Picture
    1,401 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Did you get a solution . I am facing same issue  in dynamics 365

  • AnkitSinghal Profile Picture
    256 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Hi Hemant,

    I have also tried that.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Hi Ankit,

    If form notifications are working for you then You can try setting some value when you show form notification and clear notifications something like var iserror = true/false. And then finaly in save, you check this value and prevent save accordingly

    Have not tried this but belives this should work. Worth trying.

  • Suggested answer
    Hemant Kumar Sahu Profile Picture
    1,829 on at
    RE: Xrm.Page.getControl("fieldname").clearNotification() is not working in Dynamics 365?

    Hi Ankit,

    This should work.

    Xrm.Page.getControl("fieldname").setNotification("message");

    Xrm.Page.getControl("fieldname").clearNotification();

    And you can't prevent Save by setFormNotification.

    The field notification will help you if you want to prevent Save.

    And one more thing I noticed,When tab is collapsed then the above code dont work.

    Thanks

    Hemant

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans