Показаны сообщения с ярлыком AX. Показать все сообщения
Показаны сообщения с ярлыком AX. Показать все сообщения

среда, 29 ноября 2023 г.

Open D365F&O form with specific query parameters in URL

Recently I was struggled with one task assigned to me. I had to store string as URL that points to the particular form with particular query filtered. For instance, open particular sales order or some voucher. A colleguae of mine has proposed coming up with such a logic to generate deep link with all required parameters:
       
using Microsoft.Dynamics.AX.Framework.Utilities;
using Microsoft.Dynamics.ApplicationPlatform.Environment;

class M_DeepLinkCreator
{
     /*#######################################################################################################################################*/
    public static str createDeepLink(str _menuItemName, DataSourceName _dataSourceName, Map _fieldValuesMap, DataAreaId _dataAreaId = curExt())
    {
        IApplicationEnvironment env         = EnvironmentFactory::GetApplicationEnvironment();
        System.Uri              host        = new System.Uri(env.Infrastructure.HostUrl);
        MapEnumerator           mapEnumerator;
        UrlHelper.UrlGenerator  generator   = new UrlHelper.UrlGenerator();

        generator.HostUrl       = host.GetLeftPart(System.UriPartial::Path);
        generator.Company       = _dataAreaId;
        generator.MenuItemName  = _menuItemName;

        if (_dataSourceName && _fieldValuesMap)
        {
            mapEnumerator = _fieldValuesMap.getEnumerator();

            var requestQueryParameterCollection = generator.RequestQueryParameterCollection;

            while (mapEnumerator.moveNext())
            {
                requestQueryParameterCollection.UpdateOrAddEntry(_dataSourceName, mapEnumerator.currentKey(), mapEnumerator.currentValue());
            }
        }

        return generator.GenerateFullUrl().AbsoluteUri;
    }
    /*#######################################################################################################################################*/

}    
 
Hope it's going to be useful for you in your development process.

вторник, 31 августа 2021 г.

Get the Enum name or value via SQL for D365F&O

Hello. Today I'm gonna show you how you can get the enum value based on the enum name from D365F&O. Frequently, it's quite hard to find proper enum value for some base enum, for example, InventTransType. And what if you know only the system name, but not the Id or Label and you wanted to find it as quickly as possible? Below you may find the SQL script to get all you need at once:
select t1.*, t2.* from ENUMIDTABLE t1 inner join ENUMVALUETABLE t2 on t1.ID=t2.ENUMID where t1.NAME='InventTransType'
And here what you've got
I hope that information will be useful for you. Happy DAXing!