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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

How to clear field notification in process header with javascript?

(0) ShareShare
ReportReport
Posted on by 40

Hi,

In the process flow on Opoprtunity there is a mandatory field that gives a "Required fields must be filled in" message if clicked in but blurred without entering any value.

I have a javascript that executes on process step change. In this code I would like to clear the error notification of a specific field in another step. 

I know how to clear a field/form notification for fields on the form but how do I do it in the header?

Since it is Unified Interface I normally use formcontext.getControl(xx).clearNotification(id);

I have also tried the Xrm.Page.getControl("controlname").clearNotification()  and Xrm.Page.getControl("header_process_controlname").clearNotification() and but none work.

I have the same question (0)
  • Suggested answer
    Chris4300 Profile Picture
    145 on at

    Hello Federov,

    Please take a look at this: www.inogic.com/.../

    Regards.

    Chris

  • Fedorov Profile Picture
    40 on at

    Hey, thanks. The article suggested some stuff about disabling, hiding etc which works fine but nothing about clearing a notification. Should I interpret it as saying that clearing notifications in process flow is not possible?

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Try to  debug your  javascript code , may be your code is not executing for particular scenario you mentioned. I am not sure which version you are working,  you could try to replace formcontext  instead of Xrm.Page if you are working in latest version. In addition make sure you also clear notifications from both bpf and form control together.

  • Linn Zaw Win Profile Picture
    3,407 on at

    Are you using the legacy forms in your environment? One of the suggestions in the following forum thread is to disable legacy forms

    community.dynamics.com/.../xrm-page-getcontrol-fieldname-clearnotification-is-not-working-in-dynamics-365

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    HI,

    Are you using UCI or web client?

    Xrm.page is deprecated, I would suggest you to use formcontext instead of using Xrm.Page.

    Please see below link.

    docs.microsoft.com/.../clearnotification

    Please let me know if it works.

  • Fedorov Profile Picture
    40 on at

    Hi, thanks. Yes, I'm using Unified Interface and normally I use formcontext to access all fields etc but I get negative results by using this also..

  • Linn Zaw Win Profile Picture
    3,407 on at

    In other words, are you trying to set BPF field required level using JavaScript? I don't think you can clearNotification for the mandatory field.

    If you are trying to make the Business Process Flow fields to be required conditionally, will you able to achieve with two identical steps (one with required field and another one with optional) just mentioned in this blog post?

    https://www.inogic.com/blog/2017/08/make-the-business-process-flow-fields-to-be-required-conditionally/

    If you really need to achieve it using JavaScript, you can try the other way round by making the BPF field option and make it mandatory by validating in the stage change event using formContext.data.process.addOnStageChange. If the field is empty and the field is supposed to mandatory, add custom formContext.getControl("header_process_controlname").addNotification("Required fields must be filled in");
    Here the forum thread about "Making only BPF field required using JS" and the last reply has a similar solution. You can replace the alert with addNotification and add else logic to clearNotification

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/364162/making-only-bpf-field-required-using-js

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 62 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Pallavi Phade Profile Picture

Pallavi Phade 49

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans