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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

OnOpenPage trigger issue

(0) ShareShare
ReportReport
Posted on by
Hi All,
This OnOpenPage() trigger is not executing the Hello world and UpdateQtyBase() procedure when I open a Purchase Order. What could be the issue?.
pageextension 50820 PurchLineExt extends  "Purchase Lines" 
{
    trigger OnOpenPage();
    begin        
        Message('App published: Hello world');
        UpdateQtyBase();           
    end;
}
I have the same question (0)
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    Are you sure that you extend the right page ? I don't think the "Purchase Lines" is the right page.

    The Purchase Order pages are "Purchase Order List" or "Purchase Order".

  • Romryan Profile Picture
    on at

    Teddy Herryanto,

    I just need the my function to learn after opening the PO window but when I put purchase order instead of Purchase line in my page extension, my procedure is not recognised and its underlined in RED.

    My function looks at Quantity (Base) in Purchase Line table and if its not equal to Quantity, it updates it so that it can be at par with the Quantity field.

    What can I do on purchase Order page extension so that when it opens, my function is executed?.

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    You need to know why and how you want the trigger to happen. You definitely not supposed to update Quantity (Base) without going through validation.

    I think it is not a good idea to update the record when you are opening the page. Try to re-engineer your logic. Does it make sense to do it OnOpenPage ? Does it make sense to do it OnValidate event ? Does it make sense to do it OnAfterGetRecord ? Etc.

    Know what you are trying to achieve first before doing it.

  • Romryan Profile Picture
    on at

    Teddy,

    I am asking this function is affecting Purchase Lines I tried OnInsert Trigger and OnModify but nothing good came that's why I opted to use OnOpenPage trigger. When I do use after insert trigger on SQL on this table, its working perfectly and my QtyBase is being updated but I know this is not the recommended way. Is there a trigger in AL that is equivalent to that after insert or after update of SQL??.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    We have OnAfterInsert trigger in Purchase Line table. Please using the event.

  • Suggested answer
    Chameera Kavinda Profile Picture
    510 on at

    Hi,

    Can you try by extending the "Purchase Order Subform" page.

    Thanks

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    Why not use OnAfterValidate of the Quantity or Unit of Measure Code field ?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans