
If you want to share a Form record within AX with others for example within an e-mail you can do it by using a D365FO API.
This API let’s you create URL links that point to certain forms and records
Below an example method, used in a runnable job, which generates a deep link for a record on a form, using a single field as a query parameter. To be able to test it, cop and paste the code into a runnable class and run it in USMF company of D365 one-box development environment:
using Microsoft.Dynamics.AX.Framework.Utilities;
class DeepLinkTestJob
{
private static str buildAXURL(MenuItemName _menuItemName, MenuItemType _menuItemtype, DataSourceName _dataSource='', FieldName _field='', str _value='' )
{
UrlHelper.UrlGenerator generator = new UrlHelper.UrlGenerator();
System.Uri currentHost = new System.Uri(UrlUtility::getUrl());
generator.HostUrl = currentHost.GetLeftPart(System.UriPartial::Authority);
generator.Company = curExt();
generator.MenuItemName = _menuItemName;
generator.MenuItemType = _menuItemtype;
generator.Partition = getCurrentPartition();
generator.EncryptRequestQuery = true;
if(_dataSource != '')
{
UrlHelper.RequestQueryParameterCollection requestQueryParameterCollection;
requestQueryParameterCollection = generator.RequestQueryParameterCollection;
requestQueryParameterCollection.UpdateOrAddEntry(_dataSource, _field, _value);
}
System.Uri fullURI = generator.GenerateFullUrl();
return fullURI.AbsoluteUri;
}
public static void main(Args _args)
{
str link;
link = DeepLinkTestJob::buildAXURL(menuItemDisplayStr(CustTable), MenuItemType::Display, formDataSourceStr(CustTable,CustTable), fieldstr(CustTable, AccountNum), "0001" );
info(link);
}
}
And this is the result. An URl that point to the customer number “0001”

Leave a comment