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

Sales Invoice Header amount is not showing

(0) ShareShare
ReportReport
Posted on by 410
hello all,
I am trying to sum amount of Sales Invoice Header table but it is returning 0 though amount exist. What is it? is it because flowfield? How i can get then another page?
        Var
            SaleInvoice: Record "Sales Invoice Header";
            amount: Decimal;
            TempDate: Date;
        Begin 
            TempDate: Today;
            SaleInvoice.Init();
            SaleInvoice.SetFilter("Posting Date", format(CALCDATE('<-CM>', TempDate))   '..'   format(calcdate('', TempDate)));
            if SaleInvoice.FindSet() then begin
                repeat
                    //Message('Sales Amount: '   format(SaleInvoice.Amount));
                    amount  = SaleInvoice.Amount;
                until SaleInvoice.Next() = 0;
            end;
            Message('Sales Total: '   format(amount));
        End;
  
I have the same question (0)
  • Suggested answer
    Genie Cetas Profile Picture
    472 on at

    Hi Asif,

    The Amount in Sales Invoice Header is flowfield. You must use either CalcFields or SetAutoCalcFields to retrive the value for FlowFields. 

    I have corrected your code. 

    Var
                SaleInvoice: Record "Sales Invoice Header";
                amount: Decimal;
                TempDate: Date;
            Begin 
                TempDate: Today;
                SaleInvoice.Init();
                SaleInvoice.SetFilter("Posting Date", format(CALCDATE('<-CM>', TempDate))   '..'   format(calcdate('', TempDate)));
                if SaleInvoice.FindSet() then begin
                    repeat
                        //Message('Sales Amount: '   format(SaleInvoice.Amount));
                        SalesInvoice.CalcFields(Amount); //Genie - Added
                        amount  = SaleInvoice.Amount;
                    until SaleInvoice.Next() = 0;
                end;
                Message('Sales Total: '   format(amount));
            End;

    For more information about CalcFields & SetAutoCalcFields :

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-calcfields-method

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-setautocalcfields-method

  • Community Member Profile Picture
    on at

    And i suggest you to replace SaleInvoice.Init() to SaleInvoice.reset

  • Verified answer
    Asif Shahzad Profile Picture
    410 on at

    Thank you Genie, It works.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,091 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,032 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 946 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans