我应该在哪个pwa事件中执行此操作: [英] In which pwa event should i do this:

查看:65
本文介绍了我应该在哪个pwa事件中执行此操作:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我们有一个带有自定义字段cf1的项目。我们有另一个项目级自定义字段cf2。 cf1绑定到查找表。当我们在pwa中创建项目时,需要设置cf1字段。创建项目后,我需要以编程方式设置cf2字段
,具体取决于创建时设置的cf1值。我试图在项目中使用Created事件(或在C#代码中使用OnCreated),但不幸的是,在项目创建时,自定义字段值不是,所以我不能在这里做。

We have a Project With a custom field cf1. We have another project level custom field cf2. cf1 is tied to a lookup table. When we create a project in pwa then cf1 field needs to be set. After the project is created i need to set the cf2 field programatically depending on the cf1 value set at creation. I tried to ovverride the Created event in the Project (or OnCreated in the C# code) but unfortunately while the project was created, the custom field value was not, so i couldn't do it here.

你有什么建议我应该这样做吗?在什么情况下应该这样做?

Do you have any advice where I should do this? In what event should this be done?

谢谢。

推荐答案

在OnCreated中,您无权访问数据集,只有几个属性,如PROJ_UID。要掌握数据集,您需要捕获传递数据集的OnCreating事件。在该数据集中,我希望您还可以查看已分配的自定义字段
。但是,自定义字段可能是后续保存的一部分,这需要捕获OnUpdating / OnUpdated事件。虽然每次更改都会调用此事件,因此您必须定义策略
以检测初始方案。一条路线可以在OnUpdating事件中检索项目数据集(来自工作存储)并将其与事件传递的数据集进行比较。从无到有变化可能接近
创建期间的初始序列。希望这有帮助......
In OnCreated you do not have access to the dataset, only to a couple of properties such as the PROJ_UID. To get hold of the dataset you need to trap teh OnCreating event, in which the dataset is passed. Within that dataset I would expect that you also see the custom fields that are already assigned. It may be possible though, that custom fields are part of a subsequent save, which would require to trap the OnUpdating/OnUpdated event. This event though is invoked with every change, so you must define a strategy to detect your initial scenario. One route to go could be in the OnUpdating event to retrieve the project dataset (from the working store) and compare it against the dataset passed with the event. A change from nothing to something comes probably close to the iniitial sequence during creation. Hope this helps...


这篇关于我应该在哪个pwa事件中执行此操作:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆