Dynamics 365 - Web Resources - Alert not displaying on form OnLoad

68 views
Skip to first unread message

vijay kumar

unread,
Mar 22, 2019, 12:44:14 AM3/22/19
to Microsoft Dynamics CRM
Hi,

Created a new Web Resource with the following code to display an alert onLoad  of a form.

    var Sdk = window.Sdk || {};

// Define some global variables
  
// Code to run in the form OnLoad event
     this.formOnLoad = function (executionContext) {
            var formContext = executionContext.getFormContext();
                alert('Hello World");
     }

// Code to run in the attribute OnChange event 
     this.attributeOnChange = function (executionContext) {
             var formContext = executionContext.getFormContext();
     }

//  Code to run in the form OnSave event 
             this.formOnSave = function () {
     }
}).call(Sdk);

All the calls are correctly configured
OnLoad Event: Sdk.formOnload & Pass execution connect as first parameter
No errors when loading form

Thanks

Vikranth Sinha

unread,
Mar 30, 2019, 2:10:08 AM3/30/19
to Microsoft Dynamics CRM
Hi,

I think the problem with your script is that the hello world string is not terminated

alert('Hello World"); -> RED should be single quote.

I tried the following and it works

if (typeof (Sdk) === 'undefined') { Sdk = function () { }; }

Sdk.Customer = function ()
{
// Code to run in the form OnLoad event
var formOnLoad = function(executionContext) {
//var formContext = executionContext.getFormContext();
alert('Hello World');
};
// Code to run in the attribute OnChange event 
var attributeOnChange = function(executionContext) {
var formContext = executionContext.getFormContext();
};

// Code to run in the form OnSave event 
var formOnSave = function() {
};

return {
FormLoad: formOnLoad,
AttributeOnChange: attributeOnChange,
FormOnSave: formOnSave
};
}();


If you still need help regarding Microsoft Dynamics CRM Development feel free to contact me.

Thanks,



Reply all
Reply to author
Forward
0 new messages