
Import of Exchange rates from Norges Bank
Importing exchange rates is a standard functionality in Business Central.
For the setup, we need an exchange rate service, and Norges Bank has one we can use.
We go to Norges Bank’s website and find the page with exchange rates.
https://www.norges-bank.no/tema/Statistikk/Valutakurser/?tab=api
On Norges Bank’s website, they have an API that can give us the exchange rates for list of currencies that Norges Bank lists. We can subscribe to these by going to the API page.
We can go directly here:
Here we choose the currencies we want to subscribe to. We choose the frequency where we can choose working days/monthly or yearly.
To have the most up-to-date rates in Business Central, we select business days.

We choose to access with API and press that button. Then we get this page:

Here in this image we choose the format XML and dynamic for the time period because we want to check this every working day and then this selection will give us a similar that retrieves data for the day of the day. We don’t need data for more than 1 day.
We copy the URL and hide it in a convenient place, for example in a notepad, until we need it in Business Central.
Then we have the link from Norges Bank, which will give us the exchange rates we need.
Then we move to Business Central where we search up in the search field for
Currency Exchange Rate Services
And then you get this page:

Here we provide the exchange rate service with a code and a description. And click on the three dots on the line and select new
You then come here and here it gets more complicated. Here we will enter the URL for the API from Norges Bank.
And here you need to enter column definitions for the values we want to enter in the table for exchange rates in Business Central.

To edit the source, we need to move on to data exchange definition. Then we come here:

Line 4000 (the red line) it should extract the exponent of exchange rate amounts. In Norges Bank’s file, this exponent is located as 0 or 2, i.e. the number of zeros after 1. at 0 it becomes 1 and at 2 it becomes 100.
Since Business Central does not have a good solution to this, there are 2 solutions to this. One is to create two imports of exchange rates and divide currencies by factor 1 and one by those by factor 100.
Then we need to make a change to the import definition in the field constant:

As you can see, we have to remove some of the exchange rates from the API URL we obtained from Norges Bank. We must have a URL for those who have 100 units in the currency and one for those who have 1 as the unit in the currency.
Then I have removed currencies that have 100 in their unit and we are left with these:

Then we see that it is correct. We create a new Currency Service and this time we set the constant to 100:

Notice that constant is set to 100 here.
I have changed the url to get SEK, ISK, DKK because these have a unit of 100.
When previewing, it will then be like this:

Starting the Job Queue for Automatic Update
To set up the exchange rate service as a job queue for automatic update, we activate the field enabled (marked yellow),

When we activate this, this message appears:

We then press I accept and we get this message:

Then press yes and get the job post.

We see that it is okay and is set to recurring and can then close this.
Both Exchange Rate Services must be enabled for both Unit 1 and Unit 100.
Now the exchange rate will be automatically updated in Business Central.
In BDO where I work, we have created a separate app for this so that installation is done with a click.
It also creates only one job queue and has a custom transformation rule on it.
We have also created functionality to be able to use Norges Bank’s exchange rates in companies other countries to simplify reporting for corporations. If you would like more information about this, please feel free to contact BDO – Use this contact form here.
Hope this was of interest and I priciate comments.





Leave a Reply