Schedule update of Currency Exchange Rates in Dynamics 365 CE with Flow

Posted by

Working with multiple currencies in Dynamics 365 CE, you might have the need to update the currency exchange rates on a regular basis. There are custom solutions and even a XrmToolBox plugin to do the job but let’s keep it simple and just do it with Flow.

Here is the overview of the flow:

First I initialize a variable of the type Float, since the Exchange Rate field in Dynamics 365 is a decimal number. Then I call the webservice for the exchange rates against the base currency Euro:
http://www.floatrates.com/daily/eur.json

Next I get all currency records from Dynamics 365 except the one for Euro (EUR) since that’s our base currency. Then for each record I get the details and set the Exchange Rate variable with the value from the respons (JSON) of the webservice:
float(body(‘HTTP_Get_Exchange_Rates’)?[body(‘Get_Currency_record’)?[‘isocurrencycode’]]?[‘rate’])

Last I update the currency record with the new exchange rate.

That’s all.

Credits to Pieter Veenstra who’s blog post Microsoft Flow – HTTP – calling webservices, XML vs JSON helped me with just doing the right thing. Cheers, gast!

9 comments

  1. Hi Stefan,
    Sorry for the dummy question. If your Blog is my blog how can I subscribe?
    Thanks in advance
    best regards
    Necdet

    1. Hi Necdet,
      Good point 😉
      I’ve added the possibility to subscribe to receive an e-mail notification when a new blog post is published.

  2. Hi,
    I’ve followed the flow above but I’m getting an error when capturing float(body(‘HTTP_Get_Exchange_Rates’)?[body(‘Get_Currency_record’)?[‘isocurrencycode’]]?[‘rate’])

    The error states “The expression is invalid.”
    The $filter expression must evaluate to a single boolean value.

    Can anyone assist please?

    1. Hi Claudie,
      I think you need to set the Type to ‘Float’ in the Initialize Exchange Rate variable action, the default is ‘Boolean’.

  3. Hi Stefan,
    Thank you for the wonderful flow. I have followed the flow but wonder if you are able to help with a few queries pls.

    1) For the Get record option, is the organisation name the D365 CE name? Currently only the Power Automate environments for me in list to select.

    2) I am getting an an “invalid expression” when I input the query in the expression. I have set the variable initialisation to float.

    2) For the Apply to each step, the value is not showing up for me in the dynamic content.

    1. Hi Shankar,
      In answer to your questions:
      1) The Dynamics 365 connector is officially deprecated, so you should use one of the Common Data Service connectors.
      2) Are you sure that the action names are equal to the ones used in the expression? In case of using the CDS (ce) connector the code for dynamics content fields is different.
      3) Is your default currency USD, EUR, or other?

  4. Hi Stefan,
    Thank you for your response. Please see my comments as below –

    1) Do you have the name of the CDS connector that I can use for the Get and Update currency record pls?
    3) Default currency is EUR and the business unit we have setup is a GBP one.

Leave a Reply

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