Dynamics crm 订单Microsoft CRM 4.0上联系人的帐户

Dynamics crm 订单Microsoft CRM 4.0上联系人的帐户,dynamics-crm,dynamics-crm-4,Dynamics Crm,Dynamics Crm 4,当我从联系人创建订单时,我希望联系人的帐户位于“关于”字段中,而不是联系人。正因为如此,我在onload事件中创建了一个代码,它工作得非常好 if ( (window.opener != null) && (window.opener.parent != null) && (window.opener.parent.document != null) && (window.opener.parent.document.crmForm != n

当我从联系人创建订单时,我希望联系人的帐户位于“关于”字段中,而不是联系人。正因为如此,我在onload事件中创建了一个代码,它工作得非常好

if (
(window.opener != null) && 
(window.opener.parent != null) && 
(window.opener.parent.document != null) && 
(window.opener.parent.document.crmForm != null)) {

    var parentForm = window.opener.parent.document.crmForm;
    if (parentForm.ObjectTypeName == "contact")
    {
        if (parentForm.parentcustomerid.DataValue != null)
        { 

            var newIdArray;
            newIdArray = parentForm.parentcustomerid.DataValue;
            crmForm.all.customerid.DataValue = newIdArray;
            //crmForm.all.from.DataValue = newIdArray;
        }
    }
}
当我创建报价并尝试将其转换为订单时,就会出现问题。出现以下警告错误。(我已尽最大努力将其从挪威语翻译过来)

“此字段的自定义事件出现错误。
字段:窗口
事件:Onload
错误:服务器(不是服务器程序)不可用且已消失。连接是无罪的。事件尚未发生。“

然后单击ok,它就可以正常工作了。有人知道为什么会出现这个警告消息吗


谢谢,Martin,你能调试一下你的代码吗,并检查你引用的属性是否为空

在示例中,在您的代码中,您正在检索:newIdArray=parentForm.parentcustomerid.DataValue,可能是parentForm.parentcustomerid确实为null

这是我在谷歌搜索错误消息时找到的参考:

希望这有帮助