How to Create Shareable and Secured URLs for Your Forms and Records

How to Create Shareable and Secured URLs for Your Forms and Records

If you want to share a link to a specific form or record in Dynamics 365 Finance, you can use the URL Generator to create a shareable and secured URL (also known as a deep link). A deep link can also include a data context that filters or specifies the data displayed on the form when the link is opened. This can be useful for embedding links in reports, emails, and external applications.

In this article, you will learn how to use the URL Generator to create deep links, and what security measures are applied to prevent unauthorized access or tampering.

What Is the URL Generator?

The URL Generator is a .NET library that is accessible from X++, under the following namespace:

X++ Microsoft.Dynamics.AX.Framework.Utilities.UrlHelper.UrlGenerator

The URL Generator enables developers to generate URLs that can be used to navigate to root navigable forms in a specified instance. Root navigable forms are forms that can be opened directly from a menu item. The URL Generator also enables developers to optionally specify a data context that should be displayed when navigating to the specified form.

The generated URLs can be shared, saved, and accessed from any browser with Internet access. However, the URLs are secured to prevent unauthorized access to the system, forms, or data. The URLs are also secured to prevent exposure of sensitive data or tampering.

How to Use the URL Generator?

What Is the URL Generator?

The URL Generator must be used from code running on the AOS, in an active user session or batch process. This requirement ensures that the URL can be secured through encryption specific to the instance that generates the URL.

At a minimum, the following information must be specified and passed to the URL Generator in order to generate a working URL:

  • The name of the menu item that opens the form.
  • The name of the instance where the form resides.
  • The name of the company where the form resides.

Optionally, you can also specify a data context for the form, such as a filter expression or a record ID. The data context must be compatible with the form’s query.

Here is an example of how to use the URL Generator in X++:

// Create an instance of UrlGenerator
UrlGenerator urlGenerator = new UrlGenerator();

// Set the menu item name

// Set the instance name

// Set the company name

// Set an optional data context
urlGenerator.dataContext('AccountNum == "1001"');

// Generate the URL
str url = urlGenerator.generateUrl();

// Print or return the URL

This code will generate a URL like this:

This URL will open the CustTable form in contoso instance, USMF company, and filter by AccountNum == “1001”. The token parameter is an encrypted value that secures the URL.

How Are Deep Links Secured?

How to Use the URL Generator?

Deep links are secured by several mechanisms: