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

Community site session details

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

Cannot move or modify the Field '' in the same 'PageExtension' that you added

(5) ShareShare
ReportReport
Posted on by 105
I had the following code in a Page Extension that was just fine a version or so ago but am now getting the Warning Cannot move or modify the Field 'Net Weight' in the same 'PageExtension' that you added. This warning will become an error in a future release.
 
How do I resolve this?
 
Thanks!
 
                field("Net Weight"; rec."Net Weight")
                {
                    ApplicationArea = All;
                    Caption = 'Net Weight';
                    ToolTip = 'Enter Net Weight';
                }
        Modify("Net Weight")
        {
            Trigger OnAfterValidate()
            var
            // NetSH: record "Sales Header";
                NetSL: record "Sales Line";
 
            begin
                NetSL.reset();
                //NetSL.SetRange("No.", rec."No.");
                NetSL.SetRange("Document Type", rec."Document Type");
                NetSL.SetRange("Document No.", rec."No.");
                If NetSL.FindSet() then
                    repeat
                        if NetSL.Type = NetSL.Type::Item then begin
                            NetSL.Quantity := (rec."Net Weight");
                            NetSL.Modify(true);
                            CurrPage.Update();
                        end;
                    until NetSL.Next() = 0;
            end;
 
        }
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,228 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    The code pattern indicates the AL language. Moved the question from the Dynamics 365 general to the Dynamics 365 Business central forum. 
     
     
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,261 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    You can put the trigger inside the field. there is no need to separate it.
     
    field("Net Weight"; rec."Net Weight")
    {
        ApplicationArea = All;
        Caption = 'Net Weight';
        ToolTip = 'Enter Net Weight';

        Trigger OnAfterValidate()
        var
        // NetSH: record "Sales Header";
        NetSL: record "Sales Line";
        begin
        NetSL.reset();
        //NetSL.SetRange("No.", rec."No.");
        NetSL.SetRange("Document Type", rec."Document Type");
        NetSL.SetRange("Document No.", rec."No.");
        If NetSL.FindSet() then
            repeat
                if NetSL.Type = NetSL.Type::Item then begin
                    NetSL.Quantity := (rec."Net Weight");
                    NetSL.Modify(true);
                    CurrPage.Update();
                end;
            until NetSL.Next() = 0;
        end;
    }
  • Suggested answer
    YUN ZHU Profile Picture
    94,375 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    Teddy is right. Since "Net Weight" is a new field you added to the page, you don't need to use the Modify keyword. You can just add it to the trigger in the field.
    In addition, it is recommended to add it to the trigger of the table so that it will take effect even when it is not on this page.
     
    Hope this helps as well.
    Thanks.
    ZHU
  • MJ-27012000-0 Profile Picture
    105 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    The OnAfterValidaate Trigger is not a valid trigger when I move the code to the field. Would OnValidate be the correct trigger?
  • Suggested answer
    Suresh Kulla Profile Picture
    50,241 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    Just use the trigger OnValidate in the field, something like below
     
    field("Net Weight"; rec."Net Weight")
                    {
                        ApplicationArea = All;
                        Caption = 'Net Weight';
                        ToolTip = 'Enter Net Weight';
     
                        trigger OnAfterValidate()
                        var
                            // NetSH: record "Sales Header";
                            NetSL: record "Sales Line";
     
                        begin
                            NetSL.reset();
                            //NetSL.SetRange("No.", rec."No.");
                            NetSL.SetRange("Document Type", rec."Document Type");
                            NetSL.SetRange("Document No.", rec."No.");
                            If NetSL.FindSet() then
                                repeat
                                    if NetSL.Type = NetSL.Type::Item then begin
                                        NetSL.Quantity := (rec."Net Weight");
                                        NetSL.Modify(true);
                                        CurrPage.Update();
                                    end;
                                until NetSL.Next() = 0;
                        end;
                    }
  • Suggested answer
    YUN ZHU Profile Picture
    94,375 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    Just a simple correction:
    field("Net Weight"; rec."Net Weight")
                    {
                        ApplicationArea = All;
                        Caption = 'Net Weight';
                        ToolTip = 'Enter Net Weight';
     
                        trigger OnValidate()
                        var
                            // NetSH: record "Sales Header";
                            NetSL: record "Sales Line";
     
                        begin
                            NetSL.reset();
                            //NetSL.SetRange("No.", rec."No.");
                            NetSL.SetRange("Document Type", rec."Document Type");
                            NetSL.SetRange("Document No.", rec."No.");
                            If NetSL.FindSet() then
                                repeat
                                    if NetSL.Type = NetSL.Type::Item then begin
                                        NetSL.Quantity := (rec."Net Weight");
                                        NetSL.Modify(true);
                                        CurrPage.Update();
                                    end;
                                until NetSL.Next() = 0;
                        end;
                    }
     
    Thanks.
    ZHU
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,145 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added
    Agree with the previous responses, Have you tried changes and check?
  • Vahid Ghafarpour Profile Picture
    11,997 Super User 2025 Season 2 on at
    Cannot move or modify the Field '' in the same 'PageExtension' that you added

    If any of the responses helped resolve your issue, please take a moment to mark the best answer. This helps others in the community quickly find solutions to similar problems.

    To do this, simply click the "Does this answer your question?" button on the most helpful response and like the helpful posts. If your issue is still unresolved, feel free to provide more details so the community can assist further!

    Thanks for being an active part of the Dynamics 365 Community! 😊

     

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,921

#2
YUN ZHU Profile Picture

YUN ZHU 2,012 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,999 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans