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;
}
{
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