web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Event Subscriber not working i.e. not firing the message

(0) ShareShare
ReportReport
Posted on by

Dear All,

I have an event subscriber in a code unit whereby, I need when balance account number is selected, the check on amount field should be done and if its greater than a certain other amount i.e. Amount B, the amount in the purchase journal need to be cleared until the user enters amount that's less or equal to Amount B. 

my code below doesn't fire the message and doesn't clear Amount field in the journal line of purchase journal.

 

  [EventSubscriber(ObjectType::Page, Page::"Purchase Journal", 'OnAfterValidateEvent', 'Bal. Account No.', false, false)]

    Local Procedure CheckDocumentAmount(var Rec : Record "Gen. Journal Line")

    Begin

        If Rec.Amount>(Rec.AmountB-Rec.GLBalance) then 

        Begin           

          Message('Amount exceeded by %1',Rec."Amount"-(Rec.AmountB-Rec.GLBalance)); 

              Clear(Rec."Debit Amount");

              Clear(Rec."Amount");

              Clear(Rec."Credit Amount");

              Rec.Modify();

              Message('The Transaction Amount should not exceed Amount B!'); 

        End;

    End;

The even subscriber below with the same code as above doesn't work too

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAfterValidateEvent', 'Bal. Account No.', false, false)]

What could be the issue?.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,280 Super User 2026 Season 1 on at

    I believe these fields are custom Rec.AmountB-Rec.GLBalance If you put a message box as the first statement does it show up ?

  • Romryan Profile Picture
    on at

    Yes they are custom fields.

    When I put a message box as the first statement , the Rec.AmountB-Rec.GLBalance doesn't show anything. the infor log comes up with "Amt is %" but there is no amount. I don't know why.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,280 Super User 2026 Season 1 on at

    The new fields are normal fields or flowfields? if you use Message(Format(Rec.AmountB)) do you get the value ?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 741 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 514 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 336 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans