Export selected serial nos in excel from Serial No. Information List page - Business Central Cloud06-11-2024 | 
                                
Export selected serial nos in excel from Serial No. Information List page. Business Central Cloud The below example code export the selected Serial Nos in excel and downloaded to the download folder. Put the below action on Serial No. Information List page. action(ExportSerialNoTemplate)            {                Caption = 'Export Serial No. Template';                Promoted = true;                PromotedCategory = Process;                PromotedIsBig = true;                PromotedOnly = true;                Image = Export;                ApplicationArea = All;                ToolTip = 'Executes the Export Serial No.Template action.';                trigger OnAction()                var                    SerialNoInformation: Record"Serial No. Information";                begin                    SerialNoInformation.Reset();                   CurrPage.SetSelectionFilter(SerialNoInformation);                   ExportSerialNoTemplate(SerialNoInformation);                end;            } Create a procedure to handle the export functionalities. procedureExportSerialNoTemplate(var SerialNoInformation: Record "Serial No.Information")     var        TempExcelBuffer: Record "Excel Buffer" temporary;        Filename: Text;     begin        TempExcelBuffer.Reset();        TempExcelBuffer.DeleteAll();        TempExcelBuffer.NewRow();        TempExcelBuffer.AddColumn('Serial No.', false, '', false, false, false,'', TempExcelBuffer."Cell Type"::Text);        if SerialNoInformation.FindSet() then begin            if SerialNoInformation.Count = 1 then                Filename := SerialNoInformation."SerialNo."            else                Filename := 'Serial No. Template';            repeat                TempExcelBuffer.NewRow();                TempExcelBuffer.AddColumn(SerialNoInformation."SerialNo.", false, '', false, false, false, '', TempExcelBuffer."CellType"::Text);            until SerialNoInformation.next() = 0;        end;        TempExcelBuffer.CreateNewBook('Serial No. Template');        TempExcelBuffer.WriteSheet('Serial No. Template', CompanyName, UserId);        TempExcelBuffer.CloseBook();        TempExcelBuffer.SetFriendlyFilename(Filename);        TempExcelBuffer.OpenExcel(); end; We select 4 rows from the lst. The excel file gets downloaded as below.  |