This post is part of the New Functionality In Microsoft Dynamics 365 Business Central 2024 Wave 1 series in which I am taking a look at the new functionality introduced in Microsoft Dynamics 365 Business Central 2024 Wave 1.
The 1st of the new functionality in the Development section is handle multiple file uploads and file drop zones.
The ability for AL developers to handle multiple file uploads and designate different page parts as file drop zones in Business Central provides greater flexibility and usability. This enhancement benefits developers working on applications or customizations that require multifile upload functionality and adds value to organizations by improving productivity and the user experience.
Enabled for: Users, automatically
Public Preview: Mar 2024
General Availability: Apr 2024
Feature Details
Developers can handle multiple file uploads and designate different page parts as file drop zones.
This improvement empowers AL developers to create more flexible and user-friendly interfaces within Business Central. Designating specific page parts as file drop zones lets people upload multiple files at the same time, which improves efficiency.
This feature is particularly valuable for developers working on applications or customizations that require users to upload multiple files simultaneously. By allowing users to drag and drop files onto designated page parts, developers can streamline the file upload process and simplify data entry.
The following example designates a group and field as file drop zones by referencing the ProductImageUpload action in the FileUploadAction property. The FileUploadAction action’s AllowMultipleFiles property lets developers specify whether an action can handle a single file, or multiple files. The AllowedFileExtensions property allows developers to specify the file types that people can drag to a drop zone. After you drag one or more files to a group or field on a HappyDragAndDrop page, the OnAction trigger in the FileUploadAction property is called with the list of files.
> page 50102 HappyDragAnddropPage
{
PageType = Card;
SourceTable = item;
UsageCategory = Administration;
layout
{
area(Content)
{
group(GroupName)
{
FileUploadAction = ProductImageUpload;
field(name; 'Name')
{
FileUploadAction = ProductImageUpload;
}
}
}
}
actions
{
area(Processing)
{
fileUploadAction(ProductImageUpload)
{
Caption = 'Upload product Image';
AllowMultipleFiles = false;
AllowedFileExtensions = '.jpg', '.jpeg', '.png';
trigger OnAction(files: List of [FileInfo])
var
currentFile: FileInfo;
stream: InStream;
begin
foreach currentFile in files do begin
currentFile.CreateInStream(stream);
// Code here to handle the file
Message('%1 has a length of %2', currentFile.FileName, stream.Length);
end;
end;
}
}
}
}
Click to show/hide the New Functionality In Microsoft Dynamics 365 Business Central 2024 Wave 1 Series Index
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.