Dynamics 365 - Namespaced functions not gettting called on Quick create Form onLoad

192 Views Asked by At

I have a function mapped on Quick create formOnLoad event in Dynamics.

The script is :

var CompanyName = (function (){
  return {
    testFn : function(){
      console.log("a");
    }
  }
})({});

The function mapped is : CompanyName.testFn

But it is unable to call.

This approach is working fine with other forms, but not for quickCreate

1

There are 1 best solutions below

0
On

I've confirmed your script is valid and I've added it to a Quick Create form in my test environment.

Please ensure that:

  • You've added the script's web resource to the Quick Create's form libraries
  • You've registered the Form OnLoad event handler 'CompanyName.testFn' (i.e. no brackets)
  • You've enabled the Event Handler

Also, you are only logging "a" to the console. I had to look twice to ensure that it was being logged because of the large amount of CRM-logging that takes place