Dynamics 365自带了窗体视图可编辑功能,以及可用代码控制字段的锁定和可输入!
直接上操作
- 选择需要开启子网格编辑的实体
- 在控件选项卡选择添加控件——可编辑网格
3. 当添加完成之后窗体会有一个选项卡——事件
4.在事件选项卡中添加JS和绑定方法同窗体绑定事件一致,需要注意的是,事件选择OnRecordSelect时添加方法将执行上下文作为第一个参数传递。
5.保存,发布就可以了。以下附上代码
function onrowselectDroppedProject(executionContext) {
var entityObject = executionContext.getFormContext().data.entity;
entityObject.attributes.forEach(function (attribute, i) {
var emailControl = attribute.controls.get(0);
//IC Schedule 可编辑网格控制
if (attribute.getName() != 'tec_esreview' && attribute.getName() != 'tec_vppsstaff' && attribute.getName() != 'tec_comments') {
emailControl.setDisabled(true);
}
});
}