Edit

Share via


System.Hyperlink(Text) Method

Version: Available or changed with runtime version 1.0.

Passes a URL as an argument to an Internet browser, such as Microsoft Edge.

Syntax

 System.Hyperlink(URL: Text)

Note

This method can be invoked without specifying the data type name.

Parameters

URL
 Type: Text
A URL that is passed to the Internet browser as an argument.

Remarks

The syntax must be a valid URL, such as https://www.microsoft.com, or path to a file on file share, such as file://d$/myfiles/myfile.txt. If you want the URL to be configurable, you can get the URL from a field or a variable instead. If you pass an empty string, then no browser window is opened.

At runtime, a new tab is opened in the same browser window where Dynamics 365 Business Central is running.

The HyperLink method works with different protocols and file types as along as the syntax is valid.

Note

When using the file:// protocol to open a file, the file should be stored on a network file share, not locally; otherwise the file doesn't open. Browsers block hyperlinks to files from a web page for security reasons and the hyperlink must be manually copied and pasted into a manually opened tab page.

Restrictions

  • Security enhancements restrict hyperlinks in Business Central online environments. Only IP addresses that are DNS-resolvable or that are in the RFC 1918 private address space are permitted. HTTP links are not supported — use HTTPS for all links. Noncompliant links are not executed and users see a warning dialog.
  • Protocols such as file:// and ftp:// remain supported where the environment allows them.
  • The HyperLink method is not supported on NAS services.

Example

The following example shows two uses of the HyperLink method to open the specified URL in the default browser. In the first line of code, the URL is specified in code. The second line of code illustrates how you can get a URL that is stored in a field on the current table.

HyperLink('https://www.microsoft.com');   
...  
HyperLink(Rec.UrlField);  

System Data Type
Get Started with AL
Developing Extensions