首页 > 代码库 > crm2011处理save事件和获取当前窗体信息
crm2011处理save事件和获取当前窗体信息
//防止保存记录,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();
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();
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。