CRM错误对象没有't支持属性或方法'getValue'

CRM Error Object doesn't support property or method 'getValue'

本文关键字:属性 方法 getValue 支持 对象 CRM 错误      更新时间:2023-09-26

我开始在CRM联系人页面上写一个简单的javascript来检索父帐户ID。

我将脚本设置为父帐户字段(parentcustomerid)上的onChange事件,并将其设置为"将执行上下文作为参数传递"。

这是我的代码:

function PopulateAccountType(ParentAccount) {
if (ParentAccount != null) {
    var Account = new Array();
    var Account = Xrm.Page.getAttribute("parentcustomerid").getValue();
    {
        var AccountId = Account[0].id;
    }
  }
}

不确定为什么我在OnChange事件上不断出错Object不支持属性或方法"getValue"。

我已经成功地使用了"getValue"函数,但当值是ID时,它会有所不同吗?

谢谢你的帮助,非常感谢。

-伊丽莎白

尝试此代码并取消选中执行参数复选框。

function PopulateAccountType() 
{
   var lookup = Xrm.Page.getAttribute("parentcustomerid").getValue();
   if(looup!=null)
   {
    var Account = lookup[0].id;
    alert(Account);
   }