我有一个包含三个字段的表单,我想根据不同实体的三个属性来填充这些字段。最好的方法是什么?我尝试了这个,基于我在网上找到的东西:
if (crmForm.all.new_name.DataValue == null) { return; }
var sdk = new XrmDataContext(null, null);
var id = crmForm.all.new_name.DataValue[0].id;
var fetchXml = "<fetch mapping=\"logical\"><entity name=\"mag_identificationtype\"><all-attributes /><filter type=\"and\"><condition attribute=\"new_advertisingrate\" operator=\"eq\" value=\"" + id + "\" /></filter></entity></fetch>";
var result = sdk.Fetch(fetchXml);
for (var i = 0; i < result.length; i++) {
crmForm.all.new_mediapaymentplan.DataValue = parseFloat(result[i].attributes["new_mediapaymentplan"]);
}
for (var i = 0; i < result.length; i++) {
crmForm.all.new_yellowpagepayment.DataValue = parseFloat(result[i].attributes["new_fixed_yellowpages_fee"]);
}
for (var i = 0; i < result.length; i++) {
crmForm.all.new_extrapayment.DataValue = parseFloat(result[i].attributes["new_extraadvertisingpayment"]);
}
...但它不起作用,我怀疑这是因为它是为 4.0 设计的。有没有办法在 3.0 中实现这一点,如果有,它是什么?