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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Custom JS not working as it must work

(0) ShareShare
ReportReport
Posted on by 347

Hi,

I am currently managing a D365 instance, which is designed by someone else without proper documentation. So right now I am in the middle of nowhere. However, I am moving the scripts from Xrm. Page to contextual form concept which is a tedious task. I am facing so many issues while doing this simple to look migration. For example, I am just writing a simple piece of code (see below for code reference) and getting an error. Can someone please help me with that?

function accountFormOnLoad(executionContext) {

   debugger;

   var formContext = executionContext.getFormContext(); // get formContext

   formContext.ui.clearFormNotification("1000");

   var id = formContext.data.entity.getId();

/*    if (id === "") return;

   var agreementArray = [];*/

   var level = "Info";

   var message = "Active agreement " + "00738" + ": Callouts used day = " + "4" + " and night = " + "2";

   /*if (id !== undefined) {*/

       formContext.ui.setFormNotification("Hello", "Warning", id);

   /*}*/

}

Error Message:

pastedimage1601653034800v1.jpeg

Log File:

UciError: Invalid value Warning for notificationLevel
at i (wewillfixitsandbox.crm4.dynamics.com/.../app.js
at p (wewillfixitsandbox.crm4.dynamics.com/.../app.js
at S (wewillfixitsandbox.crm4.dynamics.com/.../app.js
at wewillfixitsandbox.crm4.dynamics.com/.../8.js
at wewillfixitsandbox.crm4.dynamics.com/.../app.js
at wewillfixitsandbox.crm4.dynamics.com/.../app.js
at l._executeInternal (wewillfixitsandbox.crm4.dynamics.com/.../app.js
at l.execute (wewillfixitsandbox.crm4.dynamics.com/.../app.js
at v.execute (wewillfixitsandbox.crm4.dynamics.com/.../app.js
at ee.setFormNotification (wewillfixitsandbox.crm4.dynamics.com/.../8.js

  • Suggested answer
    Jean Joel Kakou Profile Picture
    Microsoft Employee on at

    Hello Waleed, 

    Thank you for your post on the community Forum. 

    The issue is related to the level set, it should be WARNING not Warning.

    formContext.ui.setFormNotification("Hello", "WARNING", id);

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/setformnotification

    pastedimage1601875977933v1.png

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
11manish Profile Picture

11manish 65 Super User 2026 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 37 Most Valuable Professional

#3
Travis South Profile Picture

Travis South 24

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans