Skip to main content

Notifications

Announcements

No record found.

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

Add column on the posted sales invoice list page to display field from Detailed Cust. Ledg. Entries

Posted on by 84
Hello All,
 
I want to add a new column on the Posted Sales Invoices list page to display a Credit Amount result from the line on the /Detailed Cust. Ledg. Entries/ page that contains the Document No. that starts with/Disc/.
//
//
 
 
 
 
 
 
  • Suggested answer
    Lama Khaled Profile Picture
    Lama Khaled 84 on at
    Add column on the posted sales invoice list page to display field from Detailed Cust. Ledg. Entries
    Hi Mr.YUN,
     
    I tried using Flowfield as this: 
     
        field(50124; DiscEntry; Decimal)
            {
                AutoFormatExpression = "Currency Code";
                AutoFormatType = 1;
                CalcFormula = sum("Detailed Cust. Ledg. Entry"."Credit Amount"
                where("Cust. Ledger Entry No." = FIELD("Cust. Ledger Entry No.")));
                caption = 'Discount';
                DecimalPlaces = 0 : 5;
                Editable = false;
                FieldClass = FlowField;
            }
    and tried to write trigger OnAfterGetRecord() on the page as you adviced me: 
    trigger OnAfterGetRecord()
        Var
            DCLE: Record "Detailed Cust. Ledg. Entry";
            SIH: Record "Sales Invoice Header";
     
        begin
         
     
            
            if DCLE."Document No."='DISC'
             then
                    Rec.DiscEntry := (DCLE."Credit Amount");
                end
                else
     
                        Rec.DiscEntry := 99;
     
        end;
     
    But the condition on the if statement is not correct,
    I need a function to search line by line in the "Detailed Cust. Ledg. Entry" table 
    to check if Document No on the line starts with 'DISC', Can you help me with that, please??
    I really need your advice and support in this matter with any comment even if it is small.
  • Lama Khaled Profile Picture
    Lama Khaled 84 on at
    Add column on the posted sales invoice list page to display field from Detailed Cust. Ledg. Entries
    Thanks, Mr.Yun,
     
    I need a function that I can use to get data from "Document.No" start with"DISC", Can you help me with that? 
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,565 Super User 2024 Season 2 on at
    Add column on the posted sales invoice list page to display field from Detailed Cust. Ledg. Entries
    Hi, you can try using Flowfield.
     
    If the conditions are complex and Flowfield settings cannot be completed, you can create a variable on the page and insert the value in OnAfterGetRecord().
     
     
    Hope this can give you some hints.
    Thanks.
    ZHU

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans