【发布时间】:2023-03-08 08:03:01
【问题描述】:
我正在使用 fetch 到客户端获取记录,我需要将 fetch 中的数据填充到我创建的新记录中的字段中(在客户端填充字段),但是当我使用设置值时,我得到一个错误:
无法读取 null 的属性“setValue”
我不明白为什么,字段是Null,因为新记录是空的,为什么我不能填?
function OnLoad() {
formType = Xrm.Page.ui.getFormType();
if(formType == formTypes.Create){
copyCatNewRecord();
}
}
function copyCatNewRecord(){
var xml;
xml ="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' count='1'>"
xml += "<entity name='needs'>"
xml += "<attribute name='needsid' />"
xml += "<attribute name='needsname' />"
xml += "<order attribute='modifiedon' descending='true' />"
xml += "</entity></fetch>"
var ret = frameworkGlobal.ExecuteFetchRequest(xml);
var currValue = ret[0].needsid.Value;
// This line returns an error
Xrm.Page.getAttribute("needs").setValue(currValue);
}
【问题讨论】:
标签: fetch dynamics-crm-2016 xrm