从 CRM 4 成功升级到 CRM 2011 后,一切工作正常,除了我们在几乎所有对话框(包括查找对话框)中不断收到 javascript 加载错误。
例如,当单击联系人的新按钮时,会出现对话框并且工作正常,但显示此错误:
自定义事件字段中出现错误。
字段:窗口
事件:加载
错误:对象不支持此属性或方法。
旧的crm 4系统根本没有定制。并且没有对其任何部分编写自定义 JavaScript 代码。
预先感谢您,
我尝试调试其中一个实体的问题,发现此脚本中发生错误:
var _formHierarchy = '\x7b\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22tab\x22,\x22id\x22\x3a\x22\x7be92df784-47af-48cf-a9cb-ee4811b87d10\x7d\x22,\x22name\x22\x3a\x22task\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22column\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22section\x22,\x22id\x22\x3a\x22\x7bea054020-22ab-4178-aeb7-3d664d96f88c\x7d\x22,\x22name\x22\x3a\x22task description\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b7bd07330-cc88-4056-acd1-dede64bcf1ca\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22subject\x22,\x22name\x22\x3a\x22subject\x22,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b0fde8ba1-0edc-4953-b03d-51aca06cf83c\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22description\x22,\x22name\x22\x3a\x22description\x22,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22section\x22,\x22id\x22\x3a\x22\x7bE8A0A1AE-3F40-471e-B06E-B221779CA511\x7d\x22,\x22name\x22\x3a\x22task details\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7baf141e99-5e42-4650-8e41-851d2128c4bf\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22regardingobjectid\x22,\x22name\x22\x3a\x22regardingobjectid\x22,\x22controlType\x22\x3a3\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b19816b9b-a8fc-4f92-818e-0a8c599f4107\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22ownerid\x22,\x22name\x22\x3a\x22ownerid\x22,\x22controlType\x22\x3a3\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b4ad7b570-173d-4202-855d-0029ec5d40bc\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22actualdurationminutes\x22,\x22name\x22\x3a\x22actualdurationminutes\x22,\x22controlType\x22\x3a0\x7d\x7d,\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b05145c34-364e-4cb6-ac01-de4abbec3949\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22prioritycode\x22,\x22name\x22\x3a\x22prioritycode\x22,\x22controlType\x22\x3a4\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7bcadc5253-c482-41f3-bd19-da0bf50c3274\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22scheduledend\x22,\x22name\x22\x3a\x22scheduledend\x22,\x22controlType\x22\x3a0\x7d\x7d,\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b5c548ccb-ea01-4ba8-bfa4-cef228e30aa6\x7d\x22,\x22child\x22\x3anull\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b61b62079-b04f-421a-997b-8b84164b54e7\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22category\x22,\x22name\x22\x3a\x22category\x22,\x22controlType\x22\x3a0\x7d\x7d,\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7bb200a0b7-a0d5-4eef-8b9c-8da47e7945fc\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22subcategory\x22,\x22name\x22\x3a\x22subcategory\x22,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d\x5d\x7d\x5d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22tab\x22,\x22id\x22\x3a\x22\x7bD87E07A3-11DA-4b8e-A8CC-F069EBC43FD4\x7d\x22,\x22name\x22\x3a\x22notes\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22column\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22section\x22,\x22id\x22\x3a\x22\x7b81A8A668-2716-4129-846D-E663546EC4FE\x7d\x22,\x22name\x22\x3a\x22notes\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b169ed329-a2f4-43b6-8149-17df52f49381\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22notescontrol\x22,\x22name\x22\x3anull,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d\x5d\x7d\x5d\x7d\x5d\x7d\x5d\x7d';
Sys.Application.add_load(crmFormOnLoadHandler);
function crmFormOnLoadHandler()
{
window.setTimeout('crmForm_window_onload_handler\x28Xrm.Page.ui\x29', 0);
}
function displayError(controlName, eventName, errorDescription)
{
alert('There was an error with this field\x27s customized event.' + '\n\n' + 'Field\x3a' + controlName + '\n\n' + 'Event\x3a' + eventName + '\n\n' + 'Error\x3a' + errorDescription);
}
function crmForm_window_onload_handler(eventObj,eventArgs)
{
try
{
var eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,0,null,null);
eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,0,null,eContext)
Mscrm.Form_onload();
}
catch(e)
{
displayError('window', 'onload', e.description);
}
if(Mscrm.ClientApiConstants!=null&&Mscrm.ClientApiConstants.primaryEntityId!=null){var oPrimaryEntity = $find(Mscrm.ClientApiConstants.primaryEntityId);if(oPrimaryEntity!=null) {initialFormXml=oPrimaryEntity.serialize(Mscrm.SerializationMode.onlyDirtyValues);}}}
Mscrm.Form_onload(); 行是什么导致了错误的发生。
该文件名为 formscript.js.aspx
After a successful upgrade from CRM 4 to CRM 2011 everything is working fine except we keep getting javascript onload errors in almost all dialogs including lookup ones.
for example when clicking the new button of the contacts the dialog appears and works fine but it shows this error:
There was an error in the fields customized event.
field:window
event:onload
error:object doesn't support this property or method.
The old crm 4 system was not customized at all. and no custom javascript code was made to any part of it.
Thank you in advance
I tried to debug the problem for one of the entities and found the error happens in this script:
var _formHierarchy = '\x7b\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22tab\x22,\x22id\x22\x3a\x22\x7be92df784-47af-48cf-a9cb-ee4811b87d10\x7d\x22,\x22name\x22\x3a\x22task\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22column\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22section\x22,\x22id\x22\x3a\x22\x7bea054020-22ab-4178-aeb7-3d664d96f88c\x7d\x22,\x22name\x22\x3a\x22task description\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b7bd07330-cc88-4056-acd1-dede64bcf1ca\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22subject\x22,\x22name\x22\x3a\x22subject\x22,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b0fde8ba1-0edc-4953-b03d-51aca06cf83c\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22description\x22,\x22name\x22\x3a\x22description\x22,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22section\x22,\x22id\x22\x3a\x22\x7bE8A0A1AE-3F40-471e-B06E-B221779CA511\x7d\x22,\x22name\x22\x3a\x22task details\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7baf141e99-5e42-4650-8e41-851d2128c4bf\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22regardingobjectid\x22,\x22name\x22\x3a\x22regardingobjectid\x22,\x22controlType\x22\x3a3\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b19816b9b-a8fc-4f92-818e-0a8c599f4107\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22ownerid\x22,\x22name\x22\x3a\x22ownerid\x22,\x22controlType\x22\x3a3\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b4ad7b570-173d-4202-855d-0029ec5d40bc\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22actualdurationminutes\x22,\x22name\x22\x3a\x22actualdurationminutes\x22,\x22controlType\x22\x3a0\x7d\x7d,\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b05145c34-364e-4cb6-ac01-de4abbec3949\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22prioritycode\x22,\x22name\x22\x3a\x22prioritycode\x22,\x22controlType\x22\x3a4\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7bcadc5253-c482-41f3-bd19-da0bf50c3274\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22scheduledend\x22,\x22name\x22\x3a\x22scheduledend\x22,\x22controlType\x22\x3a0\x7d\x7d,\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b5c548ccb-ea01-4ba8-bfa4-cef228e30aa6\x7d\x22,\x22child\x22\x3anull\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b61b62079-b04f-421a-997b-8b84164b54e7\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22category\x22,\x22name\x22\x3a\x22category\x22,\x22controlType\x22\x3a0\x7d\x7d,\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7bb200a0b7-a0d5-4eef-8b9c-8da47e7945fc\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22subcategory\x22,\x22name\x22\x3a\x22subcategory\x22,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d\x5d\x7d\x5d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22tab\x22,\x22id\x22\x3a\x22\x7bD87E07A3-11DA-4b8e-A8CC-F069EBC43FD4\x7d\x22,\x22name\x22\x3a\x22notes\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22column\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22section\x22,\x22id\x22\x3a\x22\x7b81A8A668-2716-4129-846D-E663546EC4FE\x7d\x22,\x22name\x22\x3a\x22notes\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x7b\x22__type\x22\x3a\x22cell\x22,\x22id\x22\x3a\x22\x7b169ed329-a2f4-43b6-8149-17df52f49381\x7d\x22,\x22child\x22\x3a\x7b\x22id\x22\x3a\x22notescontrol\x22,\x22name\x22\x3anull,\x22controlType\x22\x3a0\x7d\x7d\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d,\x7b\x22__type\x22\x3a\x22row\x22,\x22children\x22\x3a\x5b\x5d\x7d\x5d\x7d\x5d\x7d\x5d\x7d\x5d\x7d';
Sys.Application.add_load(crmFormOnLoadHandler);
function crmFormOnLoadHandler()
{
window.setTimeout('crmForm_window_onload_handler\x28Xrm.Page.ui\x29', 0);
}
function displayError(controlName, eventName, errorDescription)
{
alert('There was an error with this field\x27s customized event.' + '\n\n' + 'Field\x3a' + controlName + '\n\n' + 'Event\x3a' + eventName + '\n\n' + 'Error\x3a' + errorDescription);
}
function crmForm_window_onload_handler(eventObj,eventArgs)
{
try
{
var eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,0,null,null);
eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,0,null,eContext)
Mscrm.Form_onload();
}
catch(e)
{
displayError('window', 'onload', e.description);
}
if(Mscrm.ClientApiConstants!=null&&Mscrm.ClientApiConstants.primaryEntityId!=null){var oPrimaryEntity = $find(Mscrm.ClientApiConstants.primaryEntityId);if(oPrimaryEntity!=null) {initialFormXml=oPrimaryEntity.serialize(Mscrm.SerializationMode.onlyDirtyValues);}}}
the line Mscrm.Form_onload(); is what causing the error to happen.
the file is called formscript.js.aspx
发布评论
评论(5)
检查这个网页。我们遇到了同样的问题,最终导致 IIS 7.0 无法正确安装。我们需要重新安装 RewriteModule(包含在 CRM 安装 CD 中)
http://blogs.msdn.com/b/emeadcrmsupport/archive/2011/08/31/crm-2011-form-errors-when-opening-non-customized-forms-object-doesn- t-support-property-or-method-form-load.aspx
Check this webpage. We had the same issue and it ends up with IIS 7.0 not install correctly. We need to re-install the RewriteModule (which is included in the CRM install CD)
http://blogs.msdn.com/b/emeadcrmsupport/archive/2011/08/31/crm-2011-form-errors-when-opening-non-customised-forms-object-doesn-t-support-property-or-method-form-load.aspx
这是服务器端的问题。我不知道为什么会发生这种情况。我们还尝试进行安装修复,但没有解决问题。最后,我们在新服务器上安装了全新的 CRM 2011 副本,导入数据库并运行数据迁移管理器。错误消失了。
It was a server side problem. I don't know exactly why it happens. we also tried to do an installation repair but that didn't solve it. Finally, we installed a fresh CRM 2011 copy on a new server, imported the database and ran Data migration manager. and the error disappeared.
打开表单后,转到顶部的“自定义”选项卡并选择“自定义表单”。在表单自定义页面上,单击表单属性。您看到第一个网格中列出了任何库吗?如果是这样,那么可能存在一些您不知道的为 4.0 环境编写的自定义 JavaScript。您可以编辑库或删除它们。保存,然后发布。
After you open your form, go to the Customize tab at the top and choose Customize Form. On the form customization page, click Form Properties. Do you see any libraries listed in the first grid? If so, then there probably was some custom JavaScript written for the 4.0 environment that you didn't know about. You can either edit the libraries or remove them. Save, then publish.
您是否清除了浏览器的缓存?
也许 Dynamics CRM 4 的旧脚本仍被缓存并使用新脚本。
Do you have cleared the cache of your browser?
Maybe an old script of Dynamics CRM 4 is still cached and used instead the new one.
通过 Rhett Clinton 的此工具运行代码可能会有所帮助。它在我的第一个 4.0 到 2011 项目中运行良好,并且转换为未来的 JavaScript 迁移提供了很好的参考。
It might be helpful to run your code through this tool by Rhett Clinton. It worked well for me on my first 4.0 to 2011 project and the conversions were a good reference for future JavaScript migrations.