Dyanamics crm 2015 sp 1,拋出異常「無法獲取未定義或空引用的屬性」修剪「設置查找值。動態crm 2015通過錯誤,同時設置字段中的值
- 客戶編號有三個特性,即ID,姓名和LogicalName
- 場「new_customerprofileid」被填充了,但是的setValue()函數拋出錯誤
- 錯誤的位置是在global.ashx,有一條線
b.trim
其中通過錯誤。
代碼:
var Entity = RetrieveEntityById(Id, "SalesOrder");
if (Entity != null) {
var CustomerId = Entity.CustomerId;
if (CustomerId != null)
if (Xrm.Page.getAttribute("new_customerprofileid") != null)
Xrm.Page.getAttribute("new_customerprofileid").setValue([{ id: CustomerId.Id, name: CustomerId.Name, entityType: CustomerId.LogicalName }]);
}
一個解決方法是將線(.setValue( 「」))在try catch塊。
var Entity = RetrieveEntityById(Id, "SalesOrder");
if (Entity != null) {
var CustomerId = Entity.CustomerId;
if (CustomerId != null)
if (Xrm.Page.getAttribute("new_customerprofileid") != null)
try {
Xrm.Page.getAttribute("new_customerprofileid").setValue([{ id: CustomerId.Id, name: CustomerId.Name, entityType: CustomerId.LogicalName }]);
} catch (ex) { }
}
請回答是否有人爲此錯誤達成其他修復程序。
您正在使用哪個互聯網瀏覽器?版本是多少? –
IE 11.0.9600.17842 –
您是否確定'CustomerId'包含您期望的字段? –