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

Update Totals on Subform

(0) ShareShare
ReportReport
Posted on by 358

I have created 2 fields by extending the Sales Line table.

  1. Premium % (Decimal)
  2. Premium Amount (Decimal)

These two fields will be shown on the Sales Order Subform and will function like how Line Discount % works. It is just that, it will add the Premium Amount value to the Line Amount instead how Discount % subtracts Line Discount Amount from Line Amount.

Here is the code I have written;

 layout
    {
        addafter("Line Discount %")
        {
            field("Premium %"; "Premium %")
            {
                ApplicationArea = All;
                BlankZero = true;
                trigger OnValidate()
                begin
                    Update_Premium_Amount();
                end;
            }
            field("Premium Amount"; "Premium Amount")
            {
                ApplicationArea = All;
                BlankZero = true;
                trigger OnValidate()
                begin
                    Update_Premium_Percentage();
                end;
            }
        }

    }
    
    
    
     local procedure Update_Premium_Amount()
    var
        percValue: Decimal;
    begin
        Clear(percValue);
        percValue := rec."Premium %" / 100;
        rec."Premium Amount" := rec."Line Amount" * percValue;
        rec."Line Amount" := rec."Line Amount"   rec."Premium Amount";
        CurrPage.Update();
        UpdateAmounts();
        CalcLineAmount();
    end;

    local procedure Update_Premium_Percentage()
    begin
        if rec."Line Amount" <> 0 then begin
            rec."Premium %" := (rec."Premium Amount" * 100) / rec."Line Amount";
            rec."Line Amount" := rec."Line Amount"   rec."Premium Amount";
        end;
        CurrPage.Update();
        UpdateAmounts();
        CalcLineAmount();
    end;

My Subtotal Excl. VAT on the Subform gets updated, however, Total Excl VAT and Total Incl. VAT remains unchanged. Now I can't figure out how solve this.

  • Suggested answer
    keoma Profile Picture
    32,727 on at
    RE: Update Totals on Subform

    follow docs.microsoft.com/.../devenv-updatepropagation-property

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 501 Super User 2025 Season 1

#2
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 384

#3
Mansi Soni Profile Picture

Mansi Soni 366

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans