Easy way to avoid Infinite loop in Update plugin

I have seen many developers facing issue of infinite loop while using update method inside update plugin. I know it could be requirement specific, to use update method inside update plugin. But sometime we can void infinite issue, there is no need of calling update method. You could play with inputparmeter propertybag. For example sometime we have requirement to calculate values based on the input values scenarios like this we don’t need to use update method. So the question is how to update record without using update method in update plugin. For scenarios like these we can register our plugin on pre state and can catch our inputs from inputpropertybag and after calculating our values we can add our new property of resultant value in inputpropertybag, so no need of using update method to save value in database.

We need to follow below steps

  1. Register preupdate plugin.
  2. Read required input values from inputparameter propertybag.
  3. Calculate your resultant value.
  4. Create new property of your resultant value.
  5. Add new property to input propertybag.

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *