Today's blog post was written by Ian Moore, Senior Developer at Sonoma Partners.
Rollup fields are an excellent feature in Microsoft Dynamics that allow you to compute aggregate data for an entity across child records. They work great with Currency fields - but if you run into trouble, you must be aware of some native fields that help control currency values.
We recently encountered an issue where Currency Rollup Fields were not calculating for a particular account – other accounts in the system were fine, but one record would give warnings when it was opened.
The warning seems to point to the exact issue; one that can be common if you are loading data from external sources. Any record that has currency fields will automatically have a Currency (transactioncurrencyid) field added to it in order to have the correct value.
Trying to refresh the rollup field through the UI caused the following error pop-up with the same message:
The log file from this error also pointed to missing a missing currency somewhere in the rollup calculation:
The logical next step is to use Advanced Find to locate any records in this rollup that do not contain data for the Currency field, as well as verifying that the account itself had a Currency set.
In our case, everything looked in order. Both the account and all child entities in the rollup field contained “US Dollar” as their currency.
So, why the error?
It turns out there is a second native field involved for any currency data in Dynamics CRM: Exchange Rate
Adding Exchange Rate to our account form, we could see it was blank:
How do we set this field? Any effort to populate it through the API were fruitless – the value was simply ignored. What worked? Update one of the currency fields on your record to any value, save, and the system will automatically set the Exchange Rate for you.
With this value in place, our roll up fields calculated as expected!
If you’re having trouble with currency rollup fields, just remember to check two pieces of data:
- Currency field on the parent record and all child records
- Exchange Rate field on the parent record and all child records
Thanks for reading! If you run into further problems with this or otherwise, feel free to reach out.
This post first appeared on Sonoma Partners Microsoft CRM And Salesforce.com B, please read the originial post: here