microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
728 stars 241 forks source link

UploadIntoStream Function - Click to Browse doesnt open File chooser window when filters are used #7608

Closed danooooo1 closed 8 months ago

danooooo1 commented 8 months ago

Hi, I have a problem with the UploadIntoStream function.

When the UploadIntoStream function is used, a window opens with the text: Drag here the file you want to upload or click here to browse.

Selecting a file by dragging to the area works fine anyway, but selecting a file with "click here to browse" does not open the File Chooser window in BC 23 CU00 (runtime 12.0), but only in case that file filters are specified in the parameter of the UploadIntoStream function.

This can be demonstrated with this code:

pageextension 99999 CustomerListExt extends "Customer List"
{
    actions
    {
        addlast(Reports)
        {
            action(TestUPLOADFROMSTREAM_WithoutFilter)
            {
                Caption = 'TestUPLOADFROMSTREAM_WithoutFilter';
                Image = TestReport;
                ApplicationArea = All;

                trigger OnAction()
                var
                    FileMgt: Codeunit "File Management";
                    TempBlob: Codeunit "Temp Blob";
                    DialogCaption: Text;
                    FileFilter: Text;
                    Name: Text;
                    NVInStream: InStream;
                    UploadResult: Boolean;
                begin
                    DialogCaption := 'Please, select file';
                    Name := '';
                    FileFilter := '';
                    UploadResult := UploadIntoStream(DialogCaption, '', FileFilter, Name, NVInStream);
                end;
            }
            action(TestUPLOADFROMSTREAM_WithFilter)
            {
                Caption = 'TestUPLOADFROMSTREAM_WithFilter';
                Image = TestReport;
                ApplicationArea = All;

                trigger OnAction()
                var
                    FileMgt: Codeunit "File Management";
                    TempBlob: Codeunit "Temp Blob";
                    DialogCaption: Text;
                    FileFilter: Text;
                    Name: Text;
                    NVInStream: InStream;
                    UploadResult: Boolean;
                begin
                    DialogCaption := 'Please, select file';
                    Name := '';
                    FileFilter := 'All Files (*.*)|*.*|XML Files(*.xml)|*.xml|Text Files(*.txt;*.csv;*.asc)|*.txt;*.csv;*.asc,*.nda';
                    UploadResult := UploadIntoStream(DialogCaption, '', FileFilter, Name, NVInStream);
                end;
            }
        }
    }
}

In BC 22 CU05, both TestUPLOADFROMSTREAM_WithoutFilter and TestUPLOADFROMSTREAM_WithFilter actions work fine ("Drop" and also "Click here to browse"). But in BC 23 CU00 (also CU01) only the TestUPLOADFROMSTREAM_WithoutFilter action works well and the TestUPLOADFROMSTREAM_WithFilter action works so that this file can be moved to the selected area, but if you click on "click here to browse" nothing happens.

My complete testing took place on sandbox environments.

Could you please check it?

Thanks, Daniel

BazookaMusic commented 8 months ago

Let's get the issue to a team who will fix and backport it, as this repository is only for issues related to the AL compiler in latest developer preview environment for Dynamics 365 Business Central. We suggest that you open a support case or file a bug in Collaborate, to ensure that all Business Central users benefit from your catch as soon as possible.

To open a support case, you can:

If you file the bug in Collaborate, remember to include steps to reproduce the issue, and the Business Central build number and country version you're using.