Dynamics crm 2015 sp 1、ルックアップ値の設定中に「未定義または null 参照のプロパティ 'trim' を取得できません」という例外をスローします。
- CustomerId には、Id、Name、および LogicalName という 3 つのプロパティすべてがあります。
- フィールド「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 }]);
}
1 つの修正方法は、try catch ブロックに line( .setValue("") ) を配置することです。
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) { }
}
誰かがこのエラーの他の修正に到達した場合は回答してください。