正如问题所暗示的,我需要了解如何通过查找访问已传递给 JavaScript 函数的实体数据。
JavaScript 代码如下:
// function to generate the correct Weighting Value when these parameters change
function TypeAffectedOrRegionAffected_OnChanged(ExecutionContext, Type, Region, Weighting, Potential) {
var type = Xrm.Page.data.entity.attributes.get(Type).getValue();
var region = Xrm.Page.data.entity.attributes.get(Region).getValue();
// if we have values for both fields
if (type != null && region != null) {
// create the weighting variable
var weighting = type[0].name.substring(4) + "-" + region;
// recreate the Weighting Value
Xrm.Page.data.entity.attributes.get(Weighting).setValue(weighting);
}
}
正如您在使用名称运算符的以下行中看到的那样,我可以访问我的 Type 实体的 Type 字段。
// create the weighting variable
var weighting = type[0].name.substring(4) + "-" + region;
我现在正在寻找一种方法来访问存储在我的类型对象中的值。它具有以下字段new_type
、new_description
和。new_value
new_kind
我想我正在寻找这样的东西:
// use value of entity to assign to our form field
Xrm.Page.data.entity.attributes.get(Potential).setValue(type[0].getAttribute("new_value"));
提前感谢您的帮助。
问候,
漫画