在我们的Dynamics 365实例中,我们尝试使用code example here
为名为SourceAssessment
的实体打开快速创建表单
var thisEntity = {
entityType: "SourceAssessment",
id: Xrm.Page.data.entity.getId()
};
var callback = function (obj) {
console.log("Created new " + obj.savedEntityReference.entityType + " named '" +
obj.savedEntityReference.name + "' with id:" + obj.savedEntityReference.id);
}
var setName = { name: "Child account of " + Xrm.Page.getAttribute("name").getValue()
};
Xrm.Utility.openQuickCreate("SourceAssessment", thisEntity, setName).then(callback, function
(error) {
console.log(error.message);
});
Xrm.Page.data.entity.getId()
抛出
未捕获的TypeError:无法读取null(...)
的属性“entity”
Xrm.Page.getAttribute("name").getValue()
抛出
未捕获的TypeError:无法读取null(...)
的属性'getValue'
Xrm.Utility.openQuickCreate("SourceAssessment", thisEntity, setName).then(callback, function (error) {
console.log(error.message);
});
抛出entityLogicalName无效。此值不能为null或为空,并且必须表示组织中的实体。