File.ViewFromStream in AL: Display Text Directly from Stream

Microsoft Dynamics 365 Business Central 2025 Wave 1 continues to improve its developer experience with handy new features. One of the exciting additions in this release is the File.ViewFromStream method — a simple yet powerful function that enhances how developers interact with files stored in memory.

In the current versions of Business Central, when you need to view an attached document, a report output, or an incoming file, the typical process involves downloading the file first and then opening it with an external application. This can be time-consuming, especially when dealing with multiple files or when you simply need a quick glance at the content. Switching between applications disrupts your workflow and can feel inefficient.

📘 What is File.ViewFromStream?

The new method File.ViewFromStream(Stream: InStream,Text[,Boolean]) enables developers to open or preview a file directly from a stream, without having to save it to a temporary physical file.

This is a major convenience when working with files generated on the fly — such as PDFs, Excel files, or text reports — especially in scenarios where users just need to view or download the file rather than save it on the server.

Syntax

[Ok := ]  File.ViewFromStream(InStream: InStream, FileName: Text [, AllowDownloadAndPrint: Boolean])

🛠 Example:

procedure ShowGeneratedReport()
var
    TempBlob: Codeunit "Temp Blob";
    OutStream: OutStream;
    InStream: InStream;
    ReportContent: Text;
begin
    ReportContent := 'Hello from AL!' + Format(CurrentDateTime) + '\nThis is a preview of your text report.';

    TempBlob.CreateOutStream(OutStream);
    OutStream.WriteText(ReportContent);

    TempBlob.CreateInStream(InStream);
    File.ViewFromStream(InStream, 'ReportPreview.txt', true);
end;

💼 Use Cases

Here are some scenarios where ViewFromStream can be a game-changer:

  • Previewing customer invoices or sales reports generated on-demand.
  • Opening files attached in workflow approvals.
  • On-the-fly document generation in extensions or apps.

The File.ViewFromStream method offers a powerful and user-friendly way to present stream content directly within Dynamics 365 Business Central. The File.ViewFromStream method is a lightweight, client-friendly way to present text content on the fly in Business Central.

Stay tuned for more.

Preview PDFs Directly in Business Central Web Client (v26)

With the release of version 26, a significant productivity boost has arrived: direct PDF attachment previews within the web client. No more downloading, opening external viewers, or switching between applications. This streamlined experience lets you access and review crucial documents instantly, right within your Business Central workflow.

What Does This Mean For You?

Imagine you’re processing a purchase order and need to quickly verify the attached vendor invoice. Previously, you’d have to download the PDF, open it in a separate application, and then return to Business Central. This process was time-consuming and disruptive.

Now, with the new preview functionality, you can:

  • View PDFs directly in the FactBox: When a PDF is attached to a record (like a sales order, purchase invoice, or customer card), you can preview it instantly in the FactBox without leaving the page.
  • Save time and improve efficiency: Eliminate the need for downloads and external viewers, allowing you to focus on your core tasks.
  • Enhance collaboration: Quickly share and review documents with colleagues, streamlining approvals and decision-making.
  • Enjoy a seamless user experience: The integrated preview functionality provides a more intuitive and efficient workflow.

How Does It Work?

The new feature leverages the browser’s built-in PDF rendering capabilities. When you click on a PDF attachment in the FactBox, the document opens directly within the Business Central web client, allowing you to:

  • Scroll through pages.
  • Zoom in and out.
  • Search for specific text.

This feature is enabled by default in Business Central version 26. Simply open a record with a PDF attachment, and you’ll see the preview option in the FactBox.

For Developers:

  • Microsoft has added the following AL methods to enable this functionality.
    • File.ViewFromStream (for Business Central online)
    • File.View (for Business Central on-premises)

Unlock the Potential of Microsoft Dynamics 365 at Directions Asia 2024

Are you ready for Directions Asia 2024?

Directions Asia 2024 poised to be a significant conference for those in the SMB market, focusing on the latest advancements in ERP, CRM, and Cloud solutions. Attendees will have the opportunity to learn how to leverage powerful tools such as the Microsoft Power Platform, Microsoft Dynamics 365 Business Central, and Azure to unlock their full technological potential.

Key Aspects to Look Forward to:

  1. State-of-the-Art Keynotes: Industry leaders and experts will present the latest trends and innovations in ERP, CRM, and Cloud technologies. These sessions will provide insights into how SMBs can stay competitive and efficient by adopting these solutions.
  2. In-Depth Sessions: Breakout sessions and workshops will offer deep dives into specific aspects of Microsoft Power Platform, Dynamics 365 Business Central, and Azure. Participants can expect practical demonstrations, case studies, and best practices to help them implement and optimize these technologies.
  3. Networking Opportunities: The event will provide a platform for professionals to connect, share experiences, and collaborate. This is an excellent opportunity to meet peers, industry leaders, and potential partners.
  4. Hands-On Experience: Labs and interactive sessions will allow attendees to get hands-on experience with the latest tools and technologies. This practical approach helps in better understanding and applying the knowledge gained.
  5. Focus on SMBs: The sessions are tailored to address the specific challenges and opportunities faced by small and medium-sized businesses, ensuring that the content is relevant and actionable for this audience.

Key Technologies Highlighted:

  • Microsoft Power Platform: Learn how to use Power Apps, Power BI, and Power Automate to create custom business solutions, automate processes, and gain valuable insights from your data.
  • Microsoft Dynamics 365 Business Central: Discover how this comprehensive business management solution can streamline operations, improve customer interactions, and drive growth.
  • Co Pilot AI: A cutting-edge AI technology that provides intelligent assistance across Microsoft applications. Co Pilot AI helps businesses automate routine tasks, gain insights from data, and improve customer interactions, ultimately enhancing productivity and decision-making.
  • Microsoft Azure: Explore how Azure’s cloud services can enhance your IT infrastructure, provide robust security, and offer scalable solutions to meet your business needs.

Schedule

Directions ASIA 2024, held at the Avani+ Riverside Bangkok Hotel on May 16-17, features a packed schedule of keynotes, sessions, and workshops focused on ERP, CRM, and Cloud solutions. Highlights include sessions on Microsoft Dynamics 365 Business Central, Power Platform, Azure, and AI integration. The event offers ample networking opportunities and practical insights tailored for SMBs looking to enhance their technological capabilities.

For more details on the schedule and specific sessions, you can visit the official Directions ASIA 2024 schedule.

Venue:

Avani+ Riverside Hotel 257 Charoen Nakhon Rd, Samre, Thon Buri, Bangkok 10600, Thailand

This is one of the wonderful venue for Directions Asia 2024. Situated along the Chao Phraya River, it offers stunning views and excellent facilities, making it a perfect location for a conference of this scale.

In my view Directions Asia 2024 is an excellent opportunity for SMBs to gain cutting-edge knowledge and tools to drive their business forward using Microsoft’s powerful technology stack.

Looking forward to seeing you at Directions Asia 2024!

What is planned for Business Central Wave 1 2024 release

As we are gearing up for new release of business central and already the buzz is started for new version. Here listing few upcoming features which I am looking forward in new version.

Copilot and AI innovation

One of the hot topics in market and lot of new features are revolved around this innovation such as

Introduce Power Automate Copilot integration with Business Central

Create sales lines easily with Copilot

Create product information faster with Copilot

Complete bank account reconciliation faster with Copilot

Map e-documents to purchase order lines with Copilot

Learn more about fields with Copilot

Development

This time less features planned for development side but are important

Debug the system application : This will help us to understand the code flow while debugging the application.

Remove friction when working with external app dependencies :- With this feature MS will make it possible to download the symbols from AppSource applications so we no need to depend on publisher of app.

User experiences

Use drag and drop to attach multiple files

Use actions to navigate and highlight or fix platform-generated errors

Share error details to get help from another user

There are more and more rich features planned for this release please keep an eye on

What’s new and planned for Dynamics 365 Business Central

Stay tuned for more….