Reputation: 2170
How can a function in a namespace be called from a form event? I have tried
accountLib.accountType.showType
and
accountLib.accountType.showType()
in the onload event, but it does not work.
This is the code:
/// <reference path="Scripts/XrmPageTemplate.js" />
if (typeof (accountLib) == "undefined") {
accountLib == {}; // namespace
}
accountLib.accountType = {
showType: function () {
alert("RINNING");
}
};
Upvotes: 0
Views: 433
Reputation: 1427
You have a double == when you try to create the accountLib object. This a comparative operator and will not set the variable to be an object. If you check your console it probable throws an error on the line: accountLib.accountType = {
try:
if (!accountLib) {
accountLib = {}; // namespace
}
Upvotes: 3