Sunday, February 15, 2026

Generate a URL to navigate to D365fo for email sends

 using Microsoft.Dynamics.AX.Framework.Utilities;

using Microsoft.Dynamics.ApplicationPlatform.Environment;


public static str getRecordURL(str _menuItemName,MenuItemType _menuItemType,DataAreaId _dataArea,str _tableName,str _fieldName,str _fieldValue)
{
     str url;
     IApplicationEnvironment env = EnvironmentFactory::GetApplicationEnvironment();
     str currentUrl = env.Infrastructure.HostUrl;
     System.Uri currentHost = new System.Uri(currentUrl);

     UrlHelper.UrlGenerator generator = new UrlHelper.UrlGenerator();
     UrlHelper.RequestQueryParameterCollection requestQueryParameterCollection;


     generator.HostUrl = currentHost.GetLeftPart(System.UriPartial::Authority);
     generator.Company = _dataArea;
     generator.MenuItemName = _menuItemName;
     generator.MenuItemType = _menuItemType;
     generator.Partition = getCurrentPartition();
     generator.EncryptRequestQuery = true;

     requestQueryParameterCollection = generator.RequestQueryParameterCollection;
     requestQueryParameterCollection.UpdateOrAddEntry(_tableName, _fieldName,_fieldValue);

     System.Uri fullURI = generator.GenerateFullUrl();

     return fullURI.AbsoluteUri;
}

Thankyou

No comments:

Post a Comment

Custom Workflow in D365fo

In this blog we see all about Workflows development in D365fo  Output as shown in below We will see in this blog first way Step1:-Create a b...