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
- Register preupdate plugin.
- Read required input values from inputparameter propertybag.
- Calculate your resultant value.
- Create new property of your resultant value.
- Add new property to input propertybag.