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

Comments Action - Identify if Comments exist in table record

(6) ShareShare
ReportReport
Posted on by 765
In various pages (Customers, Vendors, Sales/Purchase Orders), comments are being maintained in the various Comments Actions.  But you cannot tell if Comments exist unless you open up the Comments Sheet.  Is there a way to modify the Comments Caption to appear differently if Comments actually exist.
 
For example, in Dynamics GP & SL, the comments button has horizontal lines if comments exist, none if empty.
 
I know a field can have a different font color based on conditions, but can the same be done for an Action Caption?  Or maybe change the Caption to "COMMENTS" when data exists?
 
Or, can I hide the existing Comments actions, create a new one on each page, and make the Image conditional depending on if data exists or not?  I see in the App Action Icons page (https://bcicons-g9hhcpg4fqatfmbj.z01.azurefd.net/) there is an empty Comment (Comment) and a Lined Comment (ViewComments).
 
Thanks.
I have the same question (0)
  • Suggested answer
    Valentin Castravet Profile Picture
    32,152 Super User 2026 Season 1 on at
    As far as I know, the icon is static and can’t be changed, though other users might have different ideas.

    An alternative is to create two actions with different icons and control their visibility based on whether comments exist. This would make the icon appear dynamic.

    However, a simpler approach would be to add a Comments FlowField on the document header, a Yes/No field that indicates whether comments exist, similar to many standard fields, see the example below:
     
     
  • Suggested answer
    YUN ZHU Profile Picture
    99,049 Super User 2026 Season 1 on at
    Hi, You can add a Flowfield and display "Yes" if it exists. It's not difficult. However, it does require a little simple customization.
    PS: Dynamics 365 Business Central: FlowFields (Sum, Average, Exist, Count, Min, Max, Lookup)
     
     
    Thanks.
    ZHU
  • Suggested answer
    OussamaSabbouh Profile Picture
    12,760 Super User 2026 Season 1 on at
    Hello,
     
    You can’t dynamically change an action caption or icon in standard AL. However, you can:
    Hide the original Comments action,
    Create a new custom action, and
    Use logic to show either Comment or ViewComments icons based on whether comments exist (via Visible or Enabled conditions).
    So yes, you can simulate the behavior, but only by replacing the action with two conditional ones.
     
    Regards,
    Oussama Sabbouh
  • Gerardo Rentería García Profile Picture
    25,555 Most Valuable Professional on at
    Hi
    According to the two colleagues, you could also consider creating a factbox that allows you to quickly view comments.
    Best
    GR
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,732 Super User 2026 Season 1 on at
    Hello,
     
    In Business Central, you can't directly change an action's caption or icon dynamically based on data, but you can work around this by hiding the default Comments action and creating two custom actions—one with an empty comment icon and one with a lined icon—then use conditional visibility based on whether comments exist for the record.
  • Suggested answer
    Rishabh Kanaskar Profile Picture
    6,219 Super User 2026 Season 1 on at
    Hi,
     
    Business Central does not support changing an Action Caption dynamically based on data. You cannot conditionally modify the caption or font color for actions.
    This requires AL development; there is no out-of-the-box feature for conditional captions or icons.
     
    Regards,
    Rishabh
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,302 Super User 2026 Season 1 on at
    We used to have the changing icon back in NAV days.
    In BC, the only way to do that is to add a boolean flowfield to get a Yes/No text.
  • Suggested answer
    ME-31032107-0 Profile Picture
    765 on at
    OK, with help from several suggestions, here is what I came up with for code (Example using the Item Card). Seems to work well, still doing some additional validation.
     
    My only issue is where the new actions appear.  I am trying to get them to be arranged where the original Comments action is displayed (after Approvals) , but it always appears at the end of the group.
     
     
    pageextension 50114 ItemCardPageExt extends "Item Card"
    {
        actions
        {
            modify("Co&mments")
            {
                Visible = False;
            }
            addafter("Approval")
            {
                action("Comments Empty")
                {
                    ApplicationArea = Comments;
                    Caption = 'Co&mments';
                    Image = Comment;
                    RunObject = Page "Comment Sheet";
                    RunPageLink = "Table Name" = const(Item),
                                      "No." = field("No.");
                    ToolTip = 'View or add comments for the record.';
                    Promoted = True;
                    PromotedCategory = Category4;
                    Visible = CommentEmpty;
                }
                action("Comments Data")
                {
                    ApplicationArea = Comments;
                    Caption = 'Co&mments';
                    Image = ViewComments;
                    RunObject = Page "Comment Sheet";
                    RunPageLink = "Table Name" = const(Item),
                                      "No." = field("No.");
                    ToolTip = 'View or add comments for the record.';
                    Promoted = True;
                    PromotedCategory = Category4;
                    Visible = CommentData;
                }
            }
        }
        trigger OnNewRecord(BelowxRec: Boolean)
        begin
            CommentEmpty := true;
            CommentData := false;
        end;
        trigger OnAfterGetRecord()
        begin
            GetComments();
        end;
        procedure GetComments()
        var
            Comments: Record "Comment Line";
            TableName: Enum "Comment Line Table Name";
        begin
            Comments.SetRange("Table Name", Comments."Table Name"::Item);
            Comments.SetRange("No.", Rec."No.");
            if Comments.FindFirst() then begin
                CommentEmpty := false;
                CommentData := true;
            end
            else begin
                CommentEmpty := true;
                CommentData := false;
            end
        end;
        var
            CommentEmpty: Boolean;
            CommentData: Boolean;
    }

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 1,804 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,103 Super User 2026 Season 1

#3
Kamal Khakhkhar Profile Picture

Kamal Khakhkhar 695

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans