【发布时间】:2015-10-07 17:22:31
【问题描述】:
我创建了这个 javascript 来自动填充一个字段,其中包含来自其他字段的值。它以 onSave 事件的形式调用。
function OppTopic() {
var products = "";
var parent = Xrm.Page.getAttribute("parentaccountid").getvalue();
var city = Xrm.Page.getAttribute("address1_city").getValue();
var automation = Xrm.Page.getAttribute("new_automationfeatures").getValue();
var service = Xrm.Page.getAttribute("new_service").getValue();
//Determines if a Product/Service is selected
if (automation == true) {//***AUTOMATION***
if (products != ""){
products += ",Automation";
}
else{
products = "Automation";
}
}
if (service == true) {//***SERVICE***
if (products != "")
products += ",Service";
else
products = "Service";
}
if (automation == false && service == false) {
products = "null";
}
var subject = parent + " - " + city + " - " + products;
Xrm.Page.getAttribute("name").setValue(subject);
}
但是,当表单被保存时,这是出现的错误。我不确定这个错误是什么意思?
我检查了字段名称,它们是正确的。 导致此错误的问题可能是什么?
谢谢
【问题讨论】:
-
在哪里获得父级的值,getvalue();有不正确的情况。 (应该是得到Value())
-
解决这个问题的最佳方法是逐步完成代码和调试。
-
也有可能是你的函数被错误调用或者没有被正确实例化。所有错误都是说您的 onsave 事件函数之一存在错误。
标签: javascript dynamics-crm-2015 auto-populate