I have been assigned to maintain customization code developed by consultants. This code includes a custom price calculation plugin that is based on a Microsoft example. As per documentation, the plugin has been registered to fire on the CalculatePrice message.
While debugging the code, I noticed that just loading or refreshing a Quote would cause the CalculatePrice message to be fired. Further investigation seems to confirm that issuing a Retrieve message triggers a CalculatePrice message (sort of corroborated on GitHub).
This behavior makes no sense to me. It results in performance penalties and unnecessarily large transaction logs. Logically, the only time CalculatePrice should fire is on Create or Update messages of relevant records/fields (kind of like workflow activities).
As such, here are some questions:
- Is anyone aware of good documentation on the topic?
- Is this out-of-the-box behavior or a result of incorrect configuration?
- If this is out-of-the-box behavior, what is the reason/justification for it?
- Is there harm in altering code to return if parent context message is
Retrieve? - Has anybody else ran into this? If so, how did you solve it?
Any answer(s) would be greatly appreciated.
