Today, we came across a scenario that we need to override the default behavior of exchange rate calculation. Whenever modifying the active records which has currency fields, money fields will be recalculated based on the exchange rate available in the system. For some cases, we may need to stop this behavior. That means, instead of taking the exchange rate from currency master, It should take the user provided value.
After going through so many forums, we finally decided that we could go by intercepting the “RetreiveExchangeRate” message.
- Somewhere you have to maintain the custom exchange rates so that you can pass to the plugin while you intercept that. It purely depends on the situation.
- Maintain your exchange rates in custom entity
- Maintain your exchange rates in the same record itself
- Write a plugin which will intercept the message “RetreiveExchangeRate” and pass your exchange rates instead of the system exchange rates
Hope you got idea on how to Override the exchange rates in Dynamics CRM.
If you need code for this, Please ping me in comments.
Happy Blogging !!!