Override the Exchange rates in Dynamics CRM

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.

Two steps:

  1. 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
  2. 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 !!!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: