Hi ,
I have the following error when loading the form of one of my custom entities :"there was an error with the field's customized event crm onload" with the name of a specific function i 'am calling , I verifiied the js file (formating ,brackets ,..) all ok .
Also i'am using the same js file in another entity & i get the same error when loading the form but with different function .
Any suggestions?
Kind Regards
*This post is locked for comments
Hello Alex and Francesco ,
Thank you a lot for your responses . i just find out what ,was the probleme.
The probleme is from another function in my js file .
Thank yousu much .
Best regards ,
David
Well.. how about timer control?
typeof(control.getDisabled) != 'undefined'
will work correctly for past, current, and future controls.
This is the function you need:
function SafeDisableAllControls() { Xrm.Page.ui.controls.forEach(function (control, index) { var controlType = control.getControlType(); if (controlType != "iframe" && controlType != "webresource" && controlType != "subgrid") { if (!control.getDisabled()) { control.setDisabled(true); } } }); }
If you found the answer helpful, please mark as Verified
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna, ITALY
Independent Contractor
Hi David,
maybe it's because not every control has "getDisabled"/"setDisabled":
try this:
function function2() {
var controls = Xrm.Page.ui.controls.get();
for (var i in controls) {
var control = controls[i];
if (typeof(control.getDisabled) != 'undefined' && !control.getDisabled()) {
control.setDisabled(true);
}
}
}
here is the first function i'am calling :
function function1() {
var Status = Xrm.Page.data.entity.attributes.get("statuscode").getValue();
if (Status == 100000000) {
function2();
}
}
function function2() {
var controls = Xrm.Page.ui.controls.get();
for (var i in controls) {
var control = controls[i];
if (!control.getDisabled()) {
control.setDisabled(true);
}
}
}
Hi Alex ,
The problem is that the entity is very customized and I have more than 1400 line of code.
for the event handler I 've added the functions to the "onload event".
Thank you
Hi David,
you'd probably need to post that script here.
And, also, maybe you could post a screenshot of how you've set up the event handler..
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156