//防止保存记录,eContext:当前上下文对象
function My_PreventSaveFunction(eContext) {
eContext.getEventArgs().preventDefault();
}
//确定哪些操作启动存储
function GetSaveModeTextFunction(eContext) {
var saveModeCode = eContext.getEventArgs().getSaveMode();
var saveModeText = "Unknown";
switch (saveModeCode) {
case 1:
saveModeText = "Save";
break;
case 2:
saveModeText = "SaveAndClose";
break;
case 5:
saveModeText = "Deactivate";
break;
case 6:
saveModeText = "Reactivate";
break;
case 7:
saveModeText = "Send";
break;
case 15:
saveModeText = "Disqualify";
break;
case 16:
saveModeText = "Qualify";
break;
case 47:
saveModeText = "Assign";
break;
case 58:
saveModeText = "SaveAsCompleted";
break;
case 59:
saveModeText = "SaveAndNew";
break;
}
return saveModeText;
}
//获取当前实体的逻辑名称
var entityName = Xrm.Page.data.entity.getEntityName();
//获取Id的当前记录
var recordId = Xrm.Page.data.entity.getId();
//保存当前记录
Xrm.Page.data.entity.save();
//判断是否更改当前记录中的任何数据
var isDirty = Xrm.Page.data.entity.getIsDirty();
//获取一个字符串,表示在保存记录时将发送到服务器的数据
var dataXml = Xrm.Page.data.entity.getDataXml();
crm2011处理save事件和获取当前窗体信息