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...
Answered

New action to Sum all amounts filtered on Sales Order List page

(0) ShareShare
ReportReport
Posted on by 160

Hi mates! :)

I need your help, I created a button on Sales Order List that count all the records (it's ok) and now, I need another one that sum all the amounts of the filtered records.

Something like:

Order 1 -> 20

Order 2 -> 40

Order 4 -> 10

Pressing button (action) and --> Total Amount: 70

pastedimage1646663234924v1.png

Is there any way to do that?

Thanks a lot :)

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,218 Super User 2026 Season 1 on at

    You can loop through all orders and assign the Amount a Sum variable and display the message at the end.

  • JMartin Profile Picture
    160 on at

    Hi Mohana :)

    How can I do that?

    Thanks! :)

  • Suggested answer
    Mohana Yadav Profile Picture
    61,218 Super User 2026 Season 1 on at

    You can start from here

    docs.microsoft.com/.../devenv-dev-overview

  • Verified answer
    Lars Lohndorf-Larsen Profile Picture
    Microsoft Employee on at

    Hello, just an example below. It is wrong at least on one point that it is totalling Amount, not Amount (LCY), so it will total $, £, etc alike. But I hope it gives you some ideas where to start:

    pageextension 50101 OrderTotals extends "Sales Order List"

    {

       layout

       {

           // Add changes to page layout here

       }

       actions

       {

           addfirst("F&unctions")

           {

               action(GetTotal)

               {

                   ApplicationArea = all;

                   Caption = 'Get Total';

                   trigger OnAction()

                   var

                       SalesHeader: Record "Sales Header";

                       Total: Decimal;

                   begin

                       Total := 0;

                       SalesHeader.copy(Rec);

                       if SalesHeader.FindSet() then

                           repeat

                               total := total + SalesHeader.Amount;

                           until SalesHeader.Next() = 0;

                       Message(Format(Total));

                   end;

               }

           }

           // Add changes to page actions here

       }

       var

           myInt: Integer;

    }

  • JMartin Profile Picture
    160 on at

    Thanks Lars!

    That worked :D

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,216 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,471 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,369

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans