开发者

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. 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\x22actualdurationm开发者_运维问答inutes\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


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


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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜