web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to generate a URL for an Incoming Document attachment and retrieve the base SaaS URL using AL?

(2) ShareShare
ReportReport
Posted on by 4,955 Super User 2026 Season 1

Hi everyone,

I am working on an AL extension for Business Central (SaaS) and I have two specific requirements regarding URLs and file attachments. I would appreciate any guidance or best practices!

My Scenario:
I am uploading files into the Incoming Documents and need to access them via a URL.

My Questions:

  1. File URL: Is it possible to generate a direct URL link to the specific uploaded file (BLOB) within the Incoming Documents using AL? Or is it only possible to generate a link to the Incoming Document record itself?

  2. SaaS URL: How can I dynamically retrieve or generate the base SaaS environment URL using AL code?

If anyone has code snippets or can point me to the right system functions (like GetUrl), that would be extremely helpful.

Thanks in advance!

Nimsara Jayathilaka

I have the same question (0)
  • Mathewjhones Profile Picture
    2 on at

    In Business Central SaaS, you generally can’t generate a true “direct file URL” for a BLOB stored in Incoming Documents, because files are kept inside the database and served through the application layer with authentication. What you can do is generate a URL that opens the Incoming Document record itself using the GetUrl system function, and from there the user can access or download the attachment via the UI. If you need something closer to a direct link, the common workaround is to expose the file through a custom API page or stream it via a codeunit and return it through a web service endpoint.

    For the base SaaS URL, you can dynamically build it using GetUrl(ClientType::Web, CompanyName, ObjectType::Page, PageId) which returns a full environment-specific URL. If you only need the base (environment) URL, you typically parse it from the result or use SessionSettings / Environment Information codeunit to get details like tenant and environment name, then construct the URL accordingly.

  • Suggested answer
    Yash_Mistry Profile Picture
    188 on at
    Hello,

    You can use Hyperlink and GetUrl functions for that. You just need to pass the filtered record for Incoming Document into GetUrl and then pass the returned URL into Hyperlink, which will open the filtered record. Make sure to set [UseFilters: Boolean] to true so that the filter is applied.

    here is one Example to Open Filtered Customer List:


    Hope this helps. Mark answer verified if it helps.

    Regards,
    Yash Mistry.
  • Suggested answer
    OussamaSabbouh Profile Picture
    14,083 Super User 2026 Season 1 on at
    Hello Nimsara Jayathilaka,
    In Business Central SaaS, you generally can’t generate a direct URL to the raw BLOB/file inside Incoming Documents from AL the same way you might on-prem; System.GetDocumentUrl(Guid) exists, but Microsoft says it’s supported only on-premises, so in SaaS the safe approach is either link to the Incoming Document record/page with GetUrl(...) or expose/download the file through an API/custom service if you need file-level access outside the client; for the base SaaS URL, use System.GetUrl(ClientType::Web) to get the current environment URL dynamically, and if you need a link to a specific record/page, use System.GetUrl(ClientType::Web, CompanyName, ObjectType::Page, Page::"Incoming Documents", Rec, true) or similar—so short version: record URL = yes, direct internal BLOB URL in SaaS = no standard supported way, environment URL = use GetUrl.
     
    Regards,
    Oussama Sabbouh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,021 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,083 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 731 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans