4 Jun’19

D365 Business CentralWorkaround to XMLPort not supported in Business Central

Problem Statement:

While I was working on some custom EFT project, I thought of using XMLPort as it is the safest and easiest method to get the data successfully directly from the tables. Unfortunately, XMLPort is not supported to work on WebClient and I was stuck with writing code to do exactly what XMLPort would do.Also, another issue that Business Central d extension support is using File methods i.e Open, Write, Close, etc.


In Business Central even if you’re not given explicit rights to deal with files directly there are streams using which we can be downloaded as files. Enough of introduction, let’s start working now!


  • VS Code
  • AL Language Extension
  • Microsoft Dynamics Business Central.

1. Creation of File Contents:
In this case, I’ve simply text string ‘Hello World!’
Although it’s perfectly possible to create more complicated strings such as XML contents using a combination of loops and text manipulating functions as needed.



2. Creation of Streams:
Using  TempBlob.Blob.CREATEOUTSTREAM(Var_OutStream) initialize the OutStream.




Using Var_OutStream.WriteText(Var_FileContent) write the text to the BLOB




Using TempBlob.Blob.CREATEINSTREAM(Var_InStream) read the contents of BLOB to InStream variable.


3. Downloading the contents of the Streams to a file:
Using DownloadFromStream(Var_Instream,FileName.FileExtension) download the contents of the InStream to a file.





That’s exactly how I was able to create a Custom Text File and download it in Business Central. You can even try with any type of text-based exports.

Written by

Olister Rumao

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Open HTML in Model pop up in D365 CE

    3 December’ 2019

    Introduction When HTML is opened using JavaScript, it can either open in the same window or a different one. This natur...

    Read more
  • Suggest Vendor Payments feature in Payment Journal – NAV/ Business Central

    3 December’ 2019

    Introduction: In this blog, I will be attempting to highlight on Suggest Vendor Payment functionality in Payment Journa...

    Read more
  • How to resolve Error “Exception from HRESULT: 0xC0202009” While data export

    3 December’ 2019

    While  Exporting data using data entity in D365 FO sometimes the Data project fails to export data with error “Ex...

    Read more
  • How to create Tabular Model Project

    30 November’ 2019

    In this blog, we will learn how to create blank Tabular model project. Pre-requisite: Visual Studio with Business Intel...

    Read more
  • How to bring “AI” to Power BI

    28 November’ 2019

    The February 2019 release of Power BI Desktop unveiled a new, out-of-the-box visual to Power BI called Key Influencer...

    Read more

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.