Call an Update on the Post Update event of an entity

By | May 26, 2010
Now everyone knows, this would result in a recursive loop. It is always preferred that in such cases, the attribute that needs to be updated should be added to the property bag in the Pre-Update event itself.

However, if you do come across a situation where you need to update an attribute on the successful update of another attribute of the same entity, you might want to check the “Depth” property that is available in the Plug-in context.

The Depth property stores the depth of the plug-in that is count of the call that has been made to the same plug-in. In case of our situation, when it calls itself the depth is incremented and we can break the recursion by check for Depth Count > 1.