web
You’re offline. This is a read only version of the page.
close
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

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
    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
    133 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
    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
    66 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
    20,612 Super User 2025 Season 2 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
    6,358 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
    8,760 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
    66 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans