Get Online Currency Exchange Rate in Dynamics Ax 2009

Hi,

If you would like to show the current exchange rate as on today for any currency in Dynamics Ax 2009 , then have a look in below steps.

I have developed DLL, which will interact with WebService to get the current exchange rate.
For illustration purpose i have taken example of "USD" to "INR" conversion.

Step 1 : Download the DLL , and copy to Dynamics AX Client Bin Folder
       
         2 : Add reference in AOT (Right Click Reference node and select Add Reference)
           Click on browse and select DLL which u copied in step1 and click Ok.
     
      3:  Refresh the client and copy the following job.

static void WebService_CurrencyConversion(Args _args)
{

    System.String exchRate;
    str           convRate;
    #Define.fromCurrency('USD')
    #Define.toCurrency('INR')
    ;

    new InteropPermission(InteropKind::ClrInterop);

    exchRate = WebServiceUtil.ServiceUtil::getExchRate(#fromCurrency, #toCurrency);

    convRate = exchRate;

    CodeAccessPermission::revertAssert();

    info(strfmt("1 %1 = %2 %3", #fromCurrency, convRate, #toCurrency));

}


Finally run this job and you will get the current exchange rate.  


You can use above logic and customize exchange rate form in Dynamics AX 2009  where the user can view exchange rate on that day.


Enjoy learning :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.