Hi, how to setup Currency Factor by Document Date. I have issue because Currency Factor only count the newest Exchange Rate. For example if i select Document Date at 01.07.2022, Currency Factor refuse to update, and stay at current day. I trying to set up this on Quotes.
Any solutions?
I used EventSubscription:
[EventSubscriber(ObjectType::Table, Database::"Purchase Header", 'OnAfterValidateEvent', 'Document Date', false, false)]
local procedure CallOnUpdateExchangeRate(CurrFieldNo: Integer; var Rec: Record "Purchase Header"; var xRec: Record "Purchase Header")
begin
if Rec."Currency Code" <> '' then
Rec.UpdateCurrencyFactor();
if Rec."Currency Factor" <> xRec."Currency Factor" then begin
Rec.ConfirmCurrencyFactorUpdate();
end;
end;
[EventSubscriber(ObjectType::Table, Database::"Purchase Header", 'OnUpdateCurrencyFactorOnAfterCurrencyDateSet', '', false, false)]
local procedure UpdateExchangeRate(CurrentFieldNo: Integer; var CurrencyDate: Date; var PurchaseHeader: Record "Purchase Header")
begin
CurrencyDate := PurchaseHeader."Document Date";
CurrentFieldNo := PurchaseHeader.FieldNo("Document Date");
end;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156