与前放;在更新,插件CRM 2011后,实体图片 [英] Pre & Post-Entity Images on Update-Plugin CRM 2011

查看:297
本文介绍了与前放;在更新,插件CRM 2011后,实体图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人为能帮助我一个问题,我一直在努力处理过了一段时间。我有一个创建插件和更新插件。出于测试目的,我创建的插件(预操作)做一个简单的计算,并把在外地结果保存后。

I hope somone can help me with a problem I been trying to deal with over some time now. I have a create plugin and a update plugin. For testing purposes my create plugin (Pre-Operation) does a simple calculation and puts the result on a field after save.

在我注册它的前置作业,改变我有我的逻辑领域我更新,插件正常工作。但是,如果我只是改变这些领域中的一个(或获得其他领域的形式脏)我得到一个错误,关键是不存在的字典。我已经做了我的研究,看到你做前处理和后实体图像之间的检查,检查什么领域都得到了更新,哪些不是。但我感到困惑的是当我这样做,我需要regrister后工作opertion我更新的插件,这将导致我的更新不再工作,如果我在我的代码做到底service.Update(实体)它给我无限循环的另一个错误。在我更新的插件我已经确信,我registerd两个图像(前置和后置)。我将不胜感激,如果有人能指点我,该怎么办前后图像之间的检查?

My update-plugin works fine when I register it on the pre-operation and change the fields I have my logic for. HOWEVER if I only change one of those fields (or get other fields dirty on the form)I get an error that the key was not present in the dictionary. I have done my research and seen that you do a check between Pre and Post Entity Image to check what fields have been updated and which not. But what I'm confused about is when I do this I need to regrister my update plugin on Post-opertion, which results to my update not working anymore and if I do service.Update(entity) at the end of my code it gives me another error of infinite loop. On my Update plugin I have made sure that I registerd two images (Pre and Post). I would appreciate if someone can advice me, how to do the checks between pre and post images?

推荐答案

我们需要看到你的代码。但我可以提供什么在那里去简短的解释。结果
service.Update(实体)呼叫你的插件一个更多的时间,因为它的另一个更新凡在你的插件被注册的实体。为了避免这种情况的无限循环,你可以看深度财产。以插件的每一个新的通话将增加该属性的值。搜索结果
。如果你想知道哪些属性更新过程中发生了变化,只是考虑的 InputParameters 的。将只有更新的属性值。搜索结果
预实体影像可供更新的消息,而不是创建(这是不可能有一个形象其实之前创建实体实例)。但后实体的图像呈现在两个创建和更新信息的情况。结果
所以,如果你需要知道什么性质发生了变化,检查InputParameters。您可以在预处理阶段插件做到这一点。和值,InputParameters更新将被存储在数据库中,所以你不需要调用service.Update。

We need to see your code. But I can provide short explanation what is going on there.
service.Update(entity) call your plugin one more time, because it's another update to entity where your plug in is registered. To avoid this infinite loop you can watch Depth property. Each new call to plugin will increase value of this property.

If you want to know what properties were changed during update, just look into InputParameters. There will be only updated properties values.

Pre-Entity images are available for Update message, but not for Create (it's impossible to have an image before entity instance was actually created). But Post-Entity image presents in case of both Create and Update messages.
So, if you need to know what properties were changed, check InputParameters. You can do this in Pre-Stage plugin. And value, updates in InputParameters will be stored in database, so you don't need call service.Update.

这篇关于与前放;在更新,插件CRM 2011后,实体图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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