AL icon indicating copy to clipboard operation
AL copied to clipboard

[BUG] Convert page control tooltip to table control tooltip does not work for non-Rec variables.

Open fvet opened this issue 11 months ago • 1 comments

Please include the following with each issue:

1. Describe the bug When a page contains various page controls with a tooltip, the Code Action 'Convert page control tooltip to table control tooltip' is shown to move the tooltips to the table level.

For page controls with a Rec.Field as SourceExpression, the tooltip is moved to the table and the tooltip is rendered correct in the webclient. For page controls with a OtherRecordVariable.Field as SourceExpression, the tooltip is moved to the table (?) and the tooltip is no longer rendered correct in the webclient.

2. To Reproduce Steps to reproduce the behavior:

  1. Go to '...'

Create a simple table without tooltips

table 50100 "My Table"
{
    Caption = 'My Table';
    DataClassification = ToBeClassified;

    fields
    {
        field(1; "My Field"; Integer)
        {
            Caption = 'My Field';
        }
    }
    keys
    {
        key(PK; "My Field")
        {
            Clustered = true;
        }
    }
}

Create a simple page with 2 page fields and tooltips.

  • One page field referencing a field by Rec.
  • One page field referencing a field using a global record variable.
namespace ALProject.ALProject;

page 50100 "My Table List"
{
    ApplicationArea = All;
    Caption = 'My Table List';
    PageType = List;
    SourceTable = "My Table";
    UsageCategory = Lists;

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field("My Field"; Rec."My Field")
                {
                    ToolTip = 'Tooltip of my field';
                }
                field("My Field 2"; MyTable."My Field")
                {
                    ToolTip = 'Tooltip of my field';
                }
            }
        }
    }

    var
        MyTable: Record "My Table";
}

Publish the project. Open the list page in the webclient. Check the tooltip for My Field (OK) and My Field 2 (OK)


Now use the Code Action to 'Convert page control tooltip to table control tooltip'

Image

Result: Tooltip is moved to table.

table 50100 "My Table"
{
    Caption = 'My Table';
    DataClassification = ToBeClassified;

    fields
    {
        field(1; "My Field"; Integer)
        {
            Caption = 'My Field';
            ToolTip = 'Tooltip of my field';  // Tooltip moved to table level
        }
    }
    keys
    {
        key(PK; "My Field")
        {
            Clustered = true;
        }
    }
}

Tooltips are removed from page controls.

page 50100 "My Table List"
{
    ApplicationArea = All;
    Caption = 'My Table List';
    PageType = List;
    SourceTable = "My Table";
    UsageCategory = Lists;

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field("My Field"; Rec."My Field")
                {
// Tooltip moved to table level
                }
                field("My Field 2"; MyTable."My Field")
                {
// Tooltip moved to table level
                }
            }
        }
    }

    var
        MyTable: Record "My Table";
}

Publish the project. Open the list page in the webclient. Check the tooltip for My Field (OK) and My Field 2 (NOK) Tooltip for My Field 2 is no longer shown.

Image

Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.

3. Expected behavior

2 solutions are possible:

  • Either by the AL team : The code action 'Convert page control tooltip to table control tooltip' should NOT move tooltips from page controls based on a global variable, other than Rec. This will prevent loss of tooltips for the MyTable."My Field" case.
  • Either by the Webclient team : The webclient should retrieve the tooltip for page fields referencing another variable than Rec., from the underlying table of the global var. For the MyTable."My Field" case, the tooltip should be retrieved from table 'My Table', field 'My Field'.

4. Actual behavior See 2.

5. Versions:

  • AL Language: 14.2.1249978
  • Visual Studio Code:
  • Business Central: BC 24 (runtime 13.1)
  • List of Visual Studio Code extensions that you have installed:
  • Operating System:
    • [x] Windows
    • [ ] Linux
    • [ ] MacOS

Final Checklist

Please remember to do the following:

  • [x] Search the issue repository to ensure you are reporting a new issue

  • [x] Reproduce the issue after disabling all extensions except the AL Language extension

  • [x] Simplify your code around the issue to better isolate the problem

Internal work item: AB#562665

fvet avatar Jan 16 '25 20:01 fvet

Very nice and detailed bug report. As you mentioned either the runtime needs to propagate the caption or the code actions should only work on Rec fields.

BazookaMusic avatar Jan 16 '25 21:01 BazookaMusic

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 27.0.33218.0 and VS Code Extension Version 16.0.1447222.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

krupybalu avatar Jul 15 '25 08:07 krupybalu