简体   繁体   English

从 CRM 4 升级到 CRM 2011 后出现 Javascript 错误

[英]Javascript errors after Upgrading from CRM 4 to CRM 2011

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.从 CRM 4 成功升级到 CRM 2011 后,一切正常,除了我们在几乎所有对话框(包括查找对话框)中不断收到 javascript 加载错误。 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.字段:window 事件:加载错误:object 不支持此属性或方法。

The old crm 4 system was not customized at all.旧的 crm 4 系统根本没有定制。 and no custom javascript code was made to any part of it.并且没有对其任何部分进行自定义 javascript 代码。

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();行 Mscrm.Form_onload(); is what causing the error to happen.是导致错误发生的原因。 the file is called formscript.js.aspx该文件名为 formscript.js.aspx

Check this webpage.检查这个网页。 We had the same issue and it ends up with IIS 7.0 not install correctly.我们遇到了同样的问题,最终导致 IIS 7.0 安装不正确。 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我们需要重新安装 RewriteModule(包含在 CRM 安装 CD 中) http://blogs.msdn.com/b/emeadcrmsupport/archive/2011/08/31/crm-2011-form-errors-when-打开非自定义表单对象不支持属性或方法表单加载.aspx

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.最后,我们在新服务器上安装了新的 CRM 2011 副本,导入数据库并运行数据迁移管理器。 and the error disappeared.错误消失了。

After you open your form, go to the Customize tab at the top and choose Customize Form.打开表单后,go 到顶部的自定义选项卡,然后选择自定义表单。 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.如果是这样,那么可能有一些您不知道的为 4.0 环境编写的自定义 JavaScript。 You can either edit the libraries or remove them.您可以编辑库或删除它们。 Save, then publish.保存,然后发布。

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.也许 Dynamics CRM 4 的旧脚本仍被缓存并使用新脚本代替。

It might be helpful to run your code through this tool by Rhett Clinton.通过 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.它在我的第一个 4.0 到 2011 项目中运行良好,并且转换是未来 JavaScript 迁移的良好参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM