Convert amount from one currency to another currency using X++

 You can use the following X++ code snippet for currency amount conversion.


    CurrencyExchangeHelper currencyExchangeHelper;

    AmountMst amountMST;

    CurrencyCode FromCurrency =  'PKR';

    AmountCur amountCur = 5000;

    currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());

    amountMST =  currencyExchangeHelper.calculateCurrencyToCurrency(fromCurrency, SLDFabCostSheetsCalculation.Currency,amountCur,true);

  

    info(strFmt("%1", amountMST));

Comments

Popular posts from this blog

Channel Setup Part 2 ---- Create Organizational Hierarchy in D365 F&O

How to Create Extended Data Types (EDTs) in Finance and Operations of Dynamics 365 -- F&O Customization Part 2

Batch Job stuck in "Waiting" state in D365 F&O?