简体   繁体   English

在 Dynamics CRM 统一接口 OnSave 事件不起作用

[英]In Dynamics CRM Unified Interface OnSave Event Doesn't Work

I have an event handler for OnSave form event following:我有以下 OnSave 表单事件的事件处理程序:

function saveEntityForm(executionContext) {
   executionContext.getFormContext().data.save().then();
}

when I am clicking on Save button on the form getting a pop up with following texts:当我单击表单上的“保存”按钮时,会弹出以下文本:

Saving in Progress正在保存

Please wait while saving is completed Error code: 0x83215603保存完成请稍候 错误代码:0x83215603

I am using Unified Interface.我正在使用统一接口。

What could be the reason of happening this issue and how to resolve it?发生此问题的原因可能是什么以及如何解决?

I have resolved the issue by myself adding setTimeout for my custom code instead of using explicit save method as following:我通过为我的自定义代码添加 setTimeout 而不是使用显式保存方法解决了这个问题,如下所示:

function saveEntityForm(executionContext) {
   // waiting few seconds to process the form
   setTimeout(() => {
      processForm(executionContext);
   }, 3000);
}

The "Please wait while saving is completed" will only appear if you try to save while the form is already saving - the form does not allow two saves to happen in parallel. “保存完成时请稍候”仅当您在表单已经保存时尝试保存时才会出现 - 表单不允许同时进行两次保存。 Thats why calling setTimeout works - it will delay calling save and by that point, the original save will be completed.这就是调用 setTimeout 起作用的原因 - 它会延迟调用 save 并且到那时,原始保存将完成。

However, note that this has performance implications and, if on a slow network, may not even work since the form may not be done saving after XXX seconds!但是,请注意,这会影响性能,如果在慢速网络上,甚至可能无法工作,因为表格可能不会在 XXX 秒后保存!

If this code is executing in an onsave event handler, you should call preventDefault() first to stop the default save from happening, and then calling executionContext.getFormContext().data.save() will work as expected (see https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/save-event-arguments/preventdefault )如果此代码在 onsave 事件处理程序中执行,则应首先调用 preventDefault() 以阻止默认保存发生,然后调用 executionContext.getFormContext().data.save() 将按预期工作(请参阅https:// docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/save-event-arguments/preventdefault )

If this code is executing in an onchange handler for a particular control, you can try calling isDefaultPrevented or getSaveMode to determine whether the form is being saved and if so, calling save() https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/save-event-arguments/isdefaultprevented如果此代码在特定控件的 onchange 处理程序中执行,您可以尝试调用 isDefaultPrevented 或 getSaveMode 以确定是否正在保存表单,如果是,则调用 save() https://docs.microsoft.com/en-us /powerapps/developer/model-driven-apps/clientapi/reference/save-event-arguments/isdefaultprevented

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在统一界面 Dynamics CRM 中部署单个组件 - Deployment individual components in unified interface Dynamics CRM Dynamics 365 CRM 统一界面中搜索结果的不同视图 - Different Views for Search Results in Dynamics 365 CRM Unified Interface 在 Dynamics 365 CRM 统一界面中重新加载/刷新子网格时重新加载表单 - Reload Form on reload/refresh of subgrid in Dynamics 365 CRM Unified Interface Dynamics crm 租户 url 不能用作 adal 回复 url - Dynamics crm tenant url doesn't work as adal reply url 在 Dynamics CRM 统一界面中的查找字段下隐藏或删除“更改视图”选项 - Hide or Remove "Change View" option under lookup field in Dynamics CRM Unified Interface Dynamics CRM报告不显示数据 - Dynamics CRM Report doesn't show data Dynamics CRM统一形式的IFRAME的setSrc无法正常工作 - setSrc for IFRAME in Dynamics CRM unified form is not working Dynamics CRM Unified服务台弹出结果 - Dynamics CRM Unified Service Desk Popup Result 如何在MS Dynamics CRM 365 v9.0中的Unified Interface App中使用特定视图打开实体记录列表页面? - How to open Entity records list page with specific view in Unified Interface App in MS Dynamics CRM 365 v9.0? 全名控件在 Dynamics 365 Unified 界面中不起作用 - Fullname control is not working in Dynamics 365 Unified interface
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM