Reading time: 2 - 4 minutes
08 February 2021


I’m working on a project which requires a dizzying combination of currencies – we’re a long way away from working in just GBP. In fact, if it was just two currencies it’d be straight forward. Microsoft Dynamics 街霸5 CRM , traditionally, has supported multiple currencies and the concept we’ve all been used to of the ‘Value’ and ‘Value_Base’ fields that we get and how we’d interact with them in a workflow would’ve gone some way towards what we wanted to achieve.

However, just to put the kibosh on that idea, here at Tecman, all new projects, where possible are being done with Power Automate rather than workflows (to be fair it’s the future!). When I started looking at the options available, one thing that was notably missing was the ‘base’ fields – I could only see the local currency fields. So, clearly, I’ve got to do my own currency conversion. I’ve also got to do it in a lot of places so something repeatable would be useful.

I decided to go for a child Flow which made sense considering the problem. Firstly, the inputs.

We will certainly need the value that’s being sent in and, as this could be a conversion from any of the available currencies to any of the others, we clearly need two currencies.

Next, a couple of decimal number variables to hold the values while we work on them.

For the next step, we need to get the exchange rate for what’s there.

And while we’re at it, let’s also get the currency for what we need the output to be in.

In terms of the conversion, because we’re going to be dealing GBP for the majority of the time, it seemed sensible to use this as our base. We have the value and we have the currency that’s being passed to us so it made sense to convert this to GBP.

If the currency being passed is GBP, we can put that straight into the MoneyIn variable. If it’s not GBP then we have access to the exchange rate in the Currency entity so we can just divide the value being passed in by the exchange rate and we’ve got the value in GBP which we can put in the variable. Now, this step is complete, we have the value being passed in GBP.

Next, we use the same logic but in reverse.

If the output currency is GBP then we already have this value in the MoneyIn variable so we can send this back. If it’s not GBP then we do another calculation of multiplying the GBP value by the exchange rate.

Finally, we need to send the figures back.

I didn’t have to include the GBP value but it didn’t make sense to not include it – it may be needed. With everything you’ve seen above, the structure of the Flow is below:

Let’s give it a test. But first, here’s a snapshot of the data in CDS that we’re going to use.

If we start a test and enter the following information (you’ll have to trust me that the CurrencyPassed is the guid for Euros and the CurrencyReqd is the guid for Polish Zloty).

I won’t go through all of the stages, hopefully, it’s fairly clear what’s happening in the Flow so we’ll just skip straight to the output.

Some simple maths will tell us whether we’re correct with these. As we were passing 1000 Euros to start with, the calculation was 1000 / 1.07 which is, indeed, £934.58. We then multiply this by the rate for Zloty and, again, £934.58 * 4.77 comes to zł4457.94.

I think that shows it’s successful. Power Automate for the win…