我想在我的网络资源中读取两个GUID进行比较。两个查找字段具有相同的相关类型,并附加了onChange
侦听器。
如果我先填充标题lookupfield,然后再填充正文查找字段,则会得到以下结果ID:
Xrm.Page.getAttribute("headerLookupField").getValue()[0].id: "91381930-5ae3-e911-812a0050568d4344"
Xrm.Page.getAttribute("bodyLookupField").getValue()[0].id: "{91381930-5AE3-E911-812A-0050568D4344}"
反之亦然,我两次都获得正确格式的正文ID。现在我的问题是:
如果我先填充标题查找字段,为什么会得到不同的GUID格式?
答案 0 :(得分:0)
如果整个系统不一致-可能是错误或设计使然:)
每当我访问GUID时,这就是我的习惯。
Xrm.Page.data.entity.getId().replace("{", "").replace("}", "")
Xrm.Page.getAttribute("lookupfield").getValue()[0].id.replace('{', '').replace('}', '');
在旁注中,Xrm.Page
在最新版本中已过时-请花点时间使用以下语法。 Read more
var formContext = executionContext.getFormContext();
var attr = formContext.getAttribute("lookupfield").getValue()[0].id.replace('{', '').replace('}', '');