Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

(0) ShareShare
ReportReport
Posted on by 5

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

  • Suggested answer
    necsa Profile Picture
    3,455 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    My final suggest changing your if logic

  • necsa Profile Picture
    3,455 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    Try to put clear syntax of notification beginning of the function.

  • AdityaTripathi Profile Picture
    5 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    Hi,

    Legacy rendering is already disabled and checked BR's also nothing else working on that field.

    Thanks

  • necsa Profile Picture
    3,455 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    Hi,

    Is the legacy form active or disable. I suggest disable the legacy form and try it again.

  • AdityaTripathi Profile Picture
    5 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    Hi Necdet Saritas,

    Used unique Id concept also still unable to clear the notification.

    Thanks in Advance.

  • Suggested answer
    necsa Profile Picture
    3,455 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    Hi,

    You must use "uniqueId" if you want to clear Notification.

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/setnotification

    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

    }

    }

  • AdityaTripathi Profile Picture
    5 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    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();

    }

    }

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    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.

  • AdityaTripathi Profile Picture
    5 on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    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

  • Community Member Profile Picture
    on at
    RE: Dynamic 365 - Clearing field level notification in JS on different tabs not working!!

    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.

    pastedimage1604474582218v1.png pastedimage1604474587313v2.png

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,060 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,858 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans