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...
Suggested Answer

Comment in Sales Line not showing in report

(6) ShareShare
ReportReport
Posted on by 90

Hi All,

I need help again. I'm running a report which is a copy of the standard Pro Forma Invoice. I noticed that in Sales Line, the "Comment" type is not showing. 

2287.PNG

I looked into the Pages Inspection in BC to check what is the type of this comment, it is (Space).

In the report, in Sales Line dataitem, on the OnAfterGetRecord() trigger is added a condition:

 if Type = Type::" " then begin
Message('Sample');
end;
To my surprise, it doesn't goes inside this condition. Is there an explanation why it doesn't include the Comment line or is there any configuration so that comment thing will appear in reporting.
Thanks
I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    Without going into details, could it be that this is an internal field not to be shown on the report itself? That was my first wild guess. But documentation indeed confirms this:

    docs.microsoft.com/.../across-how-use-comments

    It does state the following:

    Note

    Comments are not printed or output to reports or externally-facing documents.

    That said, this is by design. If you want the standard behavior to be different, write some code adjustment.

    Thanks.

  • Suggested answer
    JAngle Profile Picture
    152 on at

    The predataitem trigger for the sales lines does a filter on type::item so you will never see any other line type as that trigger is hit before the onaftergetrecord. This is needed as the onaftergetrecord does a .GET on the item table only.

    To get what you want copy the report code and create a new one if you’re cloud. I would still do this for on prem too.

  • Suggested answer
    jerome77 Profile Picture
    Microsoft Employee on at

    Hi

    I wonder if standard text code could workaround this.. I did not test, maybe good to check..

    Hope helpful

    Kind regards

    Jerome

  • Lino Asmolo Jr Profile Picture
    90 on at

    Hi Josh Anglesea,

    I think youre right, i forgot to check the predataitem. Actually, i already copy the standard report code, so  i can add custom fields there.

    Thanks

  • Rodrigo Sola Profile Picture
    69 on at
     
    Did you ever find a solution to this? The standard RDLC report prints the comments but not mine...
     
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,213 Super User 2026 Season 1 on at
    The “comment” (Type = blank) lines don’t appear because the standard Pro Forma report filters them out. Remove the filter on Type or use the Sales Comment Line table to include them in your report.
    DataItemTableView = WHERE(Type = FILTER(<> ' '));
  • Suggested answer
    OussamaSabbouh Profile Picture
    13,540 Super User 2026 Season 1 on at
    Hello,
     
    “Comment” lines are actually extended text lines with blank Type.
    Your report filters exclude blank-Type lines, so the condition never runs.
    Remove the Type filter in the Sales Line dataitem.
    Handle blank-Type lines as comments (use “Attached to Line No.”).
    Or add Sales Comment Line if you need true comment records.
     
    Regards,
    Oussama Sabbouh
  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    9,112 Super User 2026 Season 1 on at

    Hi Lino,

    The issue stems from a misunderstanding of how the Type field behaves in AL code versus how it appears in the UI. In your screenshot, the comment line is clearly marked as Type = Comment, but your AL condition is checking for a space (Type::" "), which is not a valid enum value.

    Here’s how we fix it:
     

    1. Correct the Enum Condition

    Replace your current condition with:
     

    if Type = Type::Comment then begin
        Message('Sample');
    end;

     

    This will correctly identify comment lines in the Sales Line dataitem.


    2. Check PreDataItem Filters

    Some standard reports (including Pro Forma Invoice) apply filters in the OnPreDataItem trigger that exclude non-item lines:

    SetRange(Type, Type::Item);
    If this exists in your report, it will prevent comment lines from being processed. You’ll need to remove or adjust this filter to include Type::Comment.


    3. Include Comment Lines in Layout

    Once the comment lines are included in the dataset, make sure your RDLC or Word layout is designed to display them. You may need to add conditional visibility or formatting to distinguish comment lines from item lines.


    4. Optional: Use Sales Comment Line Table

    If you're working with header-level or line-level comments stored separately, consider using the Sales Comment Line table (ID 44) instead. This table allows you to retrieve structured comments linked to specific documents or lines.


    5. Best Practice

    • Use a Boolean flag like IsCommentLine := (Type = Type::Comment); to control layout visibility.
    • Avoid relying on UI inspection alone — always validate enum values in AL code.


    Helpful Reference
    Sales Comment Line table – Microsoft Learn

    If you find this helpful, feel free to mark this as the suggested or verified answer.

    Cheers
    Jeffrey

  • Suggested answer
    Rodrigo Sola Profile Picture
    69 on at
    Hi
     
    I just wanted to say that I made it work.
     
    In RDLC and Word the Comments from a sales document line are printed through the field ItemNo.
     
    It worked in Order template but not in Invoice template but  I found a solution:
     
    Add a new row with the same fields and delete the previous row that wasn´t printing comments.
     
    Try, repeat if it didn´t work until it does. This worked for us.
     
    Best regards
  • Suggested answer
    KrisMan Profile Picture
    70 on at
    Howdy Readers
     
    the code of report 1302 Standard Sales - Pro Forma Inv filters out all lines that are not of type item, with the following code
    SetRange(Type, Type::Item);
     
    This specifically sets the type to Item Only.
     
    To allow all lines, you can use a report extension to remove the filter from the lines, as follows
     
    reportextension 50100 "DIY-ERP Pro Forma Inv RExt" extends "Standard Sales - Pro Forma Inv"
    {
        dataset
        {
            modify(Line)
            {
                // Modify the OnAfterPreDataItem trigger to allow all lines to be processed by clearing the type filter
                trigger OnAfterPreDataItem()
                begin
                    // Clear the Type filter to include all line types
                    Line.SetRange("Type");
                end;
            }
        }
    }
     
    When you use SetRange("Type") without any additional parameters, it clears any existing filters for the "Type" field and sets a new one based on its current context

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 March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,711 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 998 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 635 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans