
var
TempBlob: Codeunit "Temp Blob";
IncidentOutStream: OutStream;
IncidentInStream: InStream;
ImageFilter, FileName: Text;
begin
// Initialize the TempBlob and streams
TempBlob.CreateOutStream(IncidentOutStream);
Rec.Image.ExportStream(IncidentOutStream); // 'Rec' refers to the current Room Incident record
TempBlob.CreateInStream(IncidentInStream);
// Set the filters and filename for the image
ImageFilter := 'Image Files (*.bmp,*.jpg,*.jpeg,*.gif)|*.bmp;*.jpg;*.jpeg;*.gif';
FileName := 'Customer Picture';
// Prompt the user to download the image
if not DownloadFromStream(IncidentInStream, '', 'Download Incident Picture', '', ImageFilter, FileName) then
Error('Unable to download the image.');
end;