Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

CurrencyFactor by Document Date

Posted on by 50

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?

  • Suggested answer
    Tony00001 Profile Picture
    Tony00001 50 on at
    RE: CurrencyFactor by Document Date

    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;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans