创建新表单后保存不会重新加载 [英] Create New Form not reload after save
本文介绍了创建新表单后保存不会重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 crm 2011 中工作良好,但在 crm 2013在线中表现不佳
有机会的实体创建新记录表格我只显示:
1。某些属性(所有其他字段/部分/制表符都隐藏在表单中)
2.和 HTML按钮,例如
function OnFormLoad(){
if(Xrm.Page.ui.getFormType()== 1){
SetRequiredLevelToNone();
createHtmlButton(保存);
HideTabsAndSections()
}
其他{
}
}
单击 Html按钮时,将触发以下功能。
function showWholeForm(){
Xrm.Page.data.entity.save();
}
我想在保存后显示表单的所有字段,这意味着要重新加载
在crm 2011中工作
解决方案
要解决此问题,您可以执行以下操作:
var saved = false;
函数onLoad(){
checkIfFormShouldBeReadOnly();
attachEvent();
}
函数attachEvent(){
Xrm.Page.data.entity.addOnSave(executeOnSave);
}
函数executeOnSave(saveExecution){
if(!saved){
saved = true;
Xrm.Page.data.save()。then(
function(){
checkIfFormShouldBeReadOnly();
},
function(errorCode,message){
Xrm.Page.data.refresh();
}
);
}
}
working good in crm 2011 but not in crm 2013 online
On opportunity Entity create New record form i show only:
1.Some attributes(all other fields/Section/Tabs are hide on form)
2.and an Html button like
function OnFormLoad(){
if(Xrm.Page.ui.getFormType() == 1 ) {
SetRequiredLevelToNone();
createHtmlButton("Save");
HideTabsAndSections()
}
else {
}
}
On click of Html button following function is triggered.
function showWholeForm() {
Xrm.Page.data.entity.save();
}
I want to show all the fields of form after save, means want to reload whole form.
As working in crm 2011
解决方案
To fix this you can do:
var saved = false;
function onLoad(){
checkIfFormShouldBeReadOnly();
attachEvent();
}
function attachEvent() {
Xrm.Page.data.entity.addOnSave(executeOnSave);
}
function executeOnSave(saveExecution) {
if (!saved) {
saved = true;
Xrm.Page.data.save().then(
function () {
checkIfFormShouldBeReadOnly();
},
function (errorCode, message) {
Xrm.Page.data.refresh();
}
);
}
}
这篇关于创建新表单后保存不会重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文