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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Page Extension "Visible" property on modified field

(0) ShareShare
ReportReport
Posted on by
ENVIRONMENT

1. Product: Dynamics 365 Business Central (SaaS).
2. Version/Build: US Business Central 27.5 (Platform 27.0.51201.0 + Application 27.5.46862.51192).
3. Page: Purchase Order (Page 50 "Purchase Order").
4. Extension type: Page Extension (AL).
 
SUMMARY

1. We need to hide/show the standard "No." field on the Purchase Order page based on a custom setup flag combined with the document Status (Open vs Released). Visibility should update dynamically as the user clicks the Next/Previous record navigation arrows, without closing and reopening the page.
 
2. The underlying AL boolean recalculates correctly on every record change (confirmed via DataCaptionExpression, which uses identical logic and updates correctly during navigation). However, the field Visible property - set via modify() on the existing base-page field, bound to a page extension boolean - does not visually update on the client during navigation. It only reflects whatever state was true when the page was first opened.
 
STEPS TO REPRODUCE

1. Create a page extension on Page 50 Purchase Order:
 
pageextension 50100 "Purchase Order" extends "Purchase Order"
{
    DataCaptionExpression = TextVar;
 
    layout
    {
        modify("No.")
        {
            Visible = ShowPurchOrderNo;
        }
    }
 
    trigger OnAfterGetCurrRecord()
    begin
        SetControls();
    end;
 
    trigger OnAfterGetRecord()
    begin
        SetControls();
    end;
 
    trigger OnOpenPage()
    begin
        SetControls();
    end;
 
    local procedure SetControls()
    var
        Setup: Record Setup;
    begin
        ShowPurchOrderNo := true;
        TextVar := Rec."No." + ' - ' + Rec."Buy-from Vendor Name";
 
        if Setup.Get() then
            if Setup."Hide Purchase Order No." then
                if Rec.Status <> Rec.Status::Released then begin
                    ShowPurchOrderNo := false;
                    TextVar := Rec."Buy-from Vendor Name";
                end;
    end;
 
    var
        ShowPurchOrderNo: Boolean;
        TextVar: Text[2048];
}
 
2. Publish the extension.
3. Open the Purchase Order list with one Released order and one Open order adjacent.
4. Open the Released order - the No. field correctly shows.
5. Click the Next arrow to move to the Open order, without closing the page.
 
EXPECTED RESULT

The No. field should hide, since ShowPurchOrderNo recalculates to false for the Open record in OnAfterGetCurrRecord.
 
ACTUAL RESULT

The No. field remains visible, retaining the state from when the page was first opened. It does not update on navigation.
 
WHAT WE ALREADY VERIFIED

1. The boolean recalculates correctly every time - confirmed via DataCaptionExpression updating correctly on every Next/Previous click.
2. Tried CurrPage.Update(false) after recalculating in OnAfterGetCurrRecord - no change.
3. For comparison, native page elements defined directly in the base page (e.g. the WorkflowStatus FactBox part, bound to ShowWorkflowStatus and recalculated in OnAfterGetCurrRecord with no CurrPage.Update call) DO correctly toggle visibility per record during navigation. This suggests a difference between extension-modified existing fields and natively-defined page elements.
 4. A JavaScript Control AddIn workaround (DOM manipulation, MutationObserver, CSS injection) works but is fragile and fights the client re-render cycle - not a sustainable solution for what should be basic AL functionality.
5. Also tried subscribing to the standard integration event OnBeforePurchaseDocumentNoIsVisible in codeunit 1400 DocumentNoVisibility (the event that controls the native DocNoVisible variable bound to the No. field on the base Purchase Order page). This event only fires once, from OnOpenPage via SetDocNoVisible -> SetOpenPage, and is never re-evaluated on Next/Previous navigation - so subscribing to it does not solve the per-record dynamic visibility requirement either. It only affects whichever record happens to be loaded first when the page opens.
[EventSubscriber(ObjectType::Codeunit, Codeunit::DocumentNoVisibility, 'OnBeforePurchaseDocumentNoIsVisible', '', false, false)]
    local procedure OnBeforePurchaseDocumentNoIsVisible(DocType: Option; DocNo: Code[20]; var IsVisible: Boolean; var IsHandled: Boolean)
    var
        Setup: Record Setup;
        PurchHeader: Record "Purchase Header";
    begin
        if DocType <> 1 then // 1 = Order
            exit;
        if not Setup.Get() then
            exit;
        if not Setup."Hide Purchase Order No." then
            exit;
 
        IsHandled := true;
 
        if DocNo = '' then begin
            IsVisible := true;
            exit;
        end;
 
        if PurchHeader.Get(PurchHeader."Document Type"::Order, DocNo) then
            IsVisible := PurchHeader.Status = PurchHeader.Status::Released
        else
            IsVisible := true;
    end;
 
QUESTIONS

1. Is this a known/by-design limitation of the Visible property when set via modify() on an existing base-page field inside a page extension, specifically for re-evaluation during Next/Previous navigation?
2. Is there a supported pattern for per-record dynamic field visibility in a page extension that updates correctly during navigation without a full page reload (Page.Run)?
3. Does adding the dynamic Visible binding to a newly added field (via addafter/addbefore) instead of modifying an existing field make a behavioral difference? Is this documented anywhere?
 
Any guidance or confirmation of a platform limitation would be appreciated. Happy to share the full extension source if useful for reproduction.
I have the same question (0)

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 Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,960 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,299 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 1,131 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans