Thursday, October 2, 2025

Generate custom URL D365 FO

public static str generateFTILink(RecId _invoiceIdentifier, DataAreaId _dataAreaId)
{
    //gets the generator instance
    var generator     = new Microsoft.Dynamics.AX.Framework.Utilities.UrlHelper.UrlGenerator();
    var currentHost   = new System.Uri(UrlUtility::getUrl());
    generator.HostUrl = currentHost.GetLeftPart(System.UriPartial::Authority);
    generator.Company = _dataAreaId;
    generator.MenuItemName = menuItemDisplayStr(CustFreeInvoiceListPage);
    generator.Partition = getCurrentPartition();
    generator.PageType = FormViewOption::Details;

    var requestQueryParameterCollection = generator.RequestQueryParameterCollection;
    requestQueryParameterCollection.AddRequestQueryParameter(
    formDataSourceStr(CustFreeInvoice, CustInvoiceTable),
    'RecId', int642Str(_invoiceIdentifier));

    System.Uri fullURI = generator.GenerateFullUrl();

    // to get the encoded URI, use the following code
    return fullURI.AbsoluteUri;
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8