Skip to main content

Notifications

Dynamics 365 general forum

JavaScript not loading on the OnLoad Event of the form in the new UI

Posted on by 145

Dear Community,

I am struggeling with the issue that my custom JavaScript on the "email" form (OnLoad) is not available in the new UI. However everything is fine when I look at the form using the old interface.

My script is pretty simple, in order to test this behaviour I just created a JavaScript webresoure named mp_test.js with the following lines of code:

var Sdk = window.Sdk || {};
(function () {
    // Code to run in the form OnLoad event
    this.formOnLoad = function (executionContext) {
    alert("Hello");}
}).call(Sdk);

On the form I added the script to the library and defined the function that should be called on the OnLoad event: Sdk.formOnLoad handing over the ExecutionContext and activating it.

Once I open the form in the old interface, the alert message is showing. However, nothing happens in the new UI. I can't even find the script in the developer tools when using the new UI, meaning that it hasn't even been loaded.

Does anyone has experienced similar issues? I did test the script on another entity as well, with the exact same results.

I would appreciate any comments regarding this matter.

Thank you very much and best regards,

Philipp

  • Rajeshvarma Profile Picture
    Rajeshvarma 40 on at
    RE: JavaScript not loading on the OnLoad Event of the form in the new UI

    I Followed the Microsoft document.and sorted issue my own.

  • Rajeshvarma Profile Picture
    Rajeshvarma 40 on at
    RE: JavaScript not loading on the OnLoad Event of the form in the new UI

    Hi Philip,

    I am also facing same issue.On Form load script is not working.any workaround you found for this?

    Thanks,

    Rajesh

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: JavaScript not loading on the OnLoad Event of the form in the new UI

    Hi,

    Did you try new browser/ incognito mode? As you can't find the file, I doubt its a caching issue.

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: JavaScript not loading on the OnLoad Event of the form in the new UI

    Hi Phillip,

    As per documentation it's should work in new UI.

    Are you getting any error? If yes please share.

    Please have a look below reference -

    docs.microsoft.com/.../walkthrough-write-your-first-client-script

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans