简体   繁体   English

CRM 2011表单加载/保存

[英]CRM 2011 Form Load / Save

I need to differentiate between the normal first load/reload/refresh of a CRM 2011 form and the load of the page which is triggered on form save, in the JavaScript Web resource (Form OnLoad event). 我需要区分JavaScript Web资源(Form OnLoad事件)中CRM 2011表单的正常第一次加载/重新加载/刷新和在表单保存时触发的页面加载。

Is it possible to achieve this by using the execution context object of the load event and how could it be done? 是否可以通过使用load事件执行上下文对象来实现此目的,以及如何做到这一点? If not, is there any other working solution? 如果没有,还有其他可行的解决方案吗?

If I understand correctly, you want to identify when a form is being loaded immediately following a save in client script. 如果我理解正确,则要确定客户端脚本中保存后立即加载表单的时间。

You can't do this using the form type defined in the execution context alone, but you can do it using a custom attribute. 您不能仅使用执行上下文中定义的表单类型来执行此操作,但是可以使用自定义属性来执行此操作。 I would recommend a Yes/No optionset attribute, for example, call it "WasJustSaved". 我建议使用“是/否”选项集属性,例如,将其称为“ WasJustSaved”。

In OnLoad, you check if "WasJustSaved" = Yes and execute your logic. 在OnLoad中,检查“ WasJustSaved”是否为“ Yes”并执行逻辑。 At the end of Onload, set it to No if it's Yes. 在Onload的末尾,如果是,则将其设置为No。 Do this via a service call so as not to trigger the OnSave logic. 通过服务调用执行此操作,以免触发OnSave逻辑。

In the OnSave, set "WasJustSaved" to Yes. 在OnSave中,将“ WasJustSaved”设置为Yes。

This solution isn't perfect. 这个解决方案不是完美的。 If multiple users are working with the record at the same time, it could get confused. 如果多个用户同时使用该记录,则可能会感到困惑。 And you'll probably have to change the logic if you upgrade to 2013 or the autosave will trigger it. 如果升级到2013,则可能必须更改逻辑,否则自动保存将触发该逻辑。

In CRM there are formloads which will give you the type of form whether the create load or update load. 在CRM中,有一些表单加载,这些表单加载将为您提供表单类型,无论是创建加载还是更新加载。 So you need add the script when you want it to trigger. 因此,您需要在触发脚本时添加脚本。

Check the following link. 检查以下链接。 Hope this is what you what you want 希望这就是你想要的

http://msdynamicscrmblog.wordpress.com/2013/12/11/get-form-types-and-modes-in-dynamics-crm-2013/ http://msdynamicscrmblog.wordpress.com/2013/12/11/get-form-types-and-modes-in-dynamics-crm-2013/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM