Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, Power Apps, Power Automate, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
I have extended the sales invoice in Dynamics 365 Finance and Operations (or Finance whatever it's called now). I have a field which simply takes the tax amount in whichever currency it's in, and converts it into Euros which works fine. One of the users has now requested that instead of looking up the conversion amount by current date, they want it done by the date on the invoice (invoice date).
So my code currently is
salesInvoiceTmp.SumVATEuro = CurrencyExchangeHelper::curAmount2CurAmount(salesInvoiceTmp.SumTax, salesInvoiceTmp.CustInvoiceJourCurrencyCode, "EUR" , DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone()));
I changed it to
salesInvoiceTmp.SumVATEuro = CurrencyExchangeHelper::curAmount2CurAmount(salesInvoiceTmp.SumTax, salesInvoiceTmp.CustInvoiceJourCurrencyCode, "EUR" , custInvoiceJour.InvoiceDate);
However then i get the error
An exchange rate cannot be found for exchange rate type Default between currencies GBP and EUR on exchange date .
How to avoid this error? Apologies i'm not highly experienced in x++ development.
Make sure you have exchange rate on the InvoiceDate.
Typically exchange rates are maintained monthly or weekly. They are setup at General Ledger > Currencies > Currency exchange rates. Set one up between the two currencies and then you should be all set.
Why is this adjustment required?
In the sales order form there is a totals button/form available.
In this form users can switch between the different currencies and previews the values.
I cannot see the necessity for making this system modification.
Would be great if you could elaborate.
Hi, @Evaldas yes that's obvious but if there is no date, how do i handle it that's my question... thanks.
Test the date and set the alternative if that is required.
CustInvoiceJour.InvoiceDate ? CustInvoiceJour.InvoiceDate : DateTimeUtil::getToday()
What else could you do? :)
Why would there be invoice with no date? The problem is exchange rate and until you verify that the issue will remain. Did you verify exchange rate?
@Evaldas This is the kind of thing i was looking for I actually ended up using an if statement. The reason why I was getting the error i believe is because although i was returning the date, there was another query further down that was affecting this and causing issues. Agree with other posts there should always be a conversion for every invoice date so this should not be needed. @Ludwig this is the invoice output i'm talking about (ssrs report) thanks all for the help.
Business Applications communities