Thursday, September 4, 2014

AX 2012 - Retrieve a Dimension Value from a Index

Hi Guys

Below an useful code for retrieve a Financial Dimension value from an Index :

static DimensionValue DisplayDimensionValueFromIndex( DimensionDefault _DefaultDimension, int _level)
        DimensionValue      ret;
        if( _defaultDimension && _level )
            select RecId, Name
            from LedgerChartOfAccounts
            where LedgerChartOfAccounts.Name == curext()
                join ChartOfAccounts, DimensionHierarchy
                from LedgerChartOfAccountsStructure          
                where LedgerChartOfAccountsStructure.ChartOfAccounts == LedgerChartOfAccounts.RecId
                    join DimensionAttribute, DimensionHierarchy, Level
                    from DimensionHierarchyLevel
                    where DimensionHierarchyLevel.DimensionHierarchy == LedgerChartOfAccountsStructure.DimensionHierarchy
                       && DimensionHierarchyLevel.Level == _level;
            ret = DimensionAttributeValueSetStorage::find(_DefaultDimension).getDisplayValueByDimensionAttribute(DimensionHierarchyLevel.DimensionAttribute);
        return ret;


Monday, June 16, 2014

What are the differences between addOrderByField and addSortField

Hi Guys

With addSortField you can set "only" the records order.

With AddOrderByField you can build some logic because is used the kernel class QueryOrderByField.

So, you can use the follow methods :
- direction
- autoHeader
- autoHeaderDetailLevel
- autoSum
- autoSumDetailLevel
- datasource
- fieldId

You can find some examples on the standard class :

- DimensionProvider Class, getDimensionOrderBysFromQuery method
- InventDimCtrl_Frm_OnHand class, modifyQuery method


Sunday, May 18, 2014

OData Query Service - The exception message is 'Object reference not set to an instance of an object.'.

Hi Technophiles!

The server encountered an error processing the request. The exception message is 'Object reference not set to an instance of an object.'.

If someone have faced this error through browsing the link "http://aoshost:8101/DynamicsAx/Services/ODataQueryService/", the cause could be a query specify on the "Document data sources form" ( Organization Administration > Setup > Document management  ) that doesn't exist anymore.
So, from the form above, delete the queries that no longer exist.

Finally, if you faced problem with the link above, change the AOS server name with the IP address, like

See you soon!


Tuesday, April 8, 2014

Email Parameters - Retrieve SMTP Account Password

Hi All

If you don't know or remember the SMTP Account Password, you can use the code below :

    CryptoBlob  CryptoBlob;
    CryptoBlob = WinapiServer::cryptUnProtectData( (select firstonly SysEmailSMTPPassword).Password );
    info ( cryptoblob2str(CryptoBlob) );

That's it! 

Sunday, April 6, 2014

MVP 2014 on Dynamics AX


Few days ago, Microsoft given me the award as MVP on Dynamics AX.
I'm very excited and I do not believe yet.
Thanks to all and I'll continue to work hard to grow on Dynamics AX.

Stay tuned!


Friday, March 14, 2014

How to get Label Id from a text

Hi All

If you want retrieve the Label ID from a specific text description, here the code.
If are present more Label ID for a specific text, you will have the first.

   sysLabelEdit     sysLabelEdit = New sysLabelEdit();
   labelid          labelid;
   str              text = "Customer account";
   str              specialCharsText;
   specialCharsText = SysLabel::searchStringBuildSpecialCharString(text);   
   specialCharsText = SysLabel::seachStringBuildExactStr(specialCharsText);
   labelid = sysLabelEdit.findLabel("en-us", specialCharsText);
   info ( labelid );

That's all!


Friday, March 7, 2014

The SSRS report labels do not display or the report shows label IDs

Hi guys

If labels are not shown in the SSRS reports, try to follow this suggestion :

1- Check the SSRS Service Account password, could be invalid :

2- Refresh the AX Cache, so through MenĂ¹ Tool\Caches, run Refresh Dictionary, Refresh Data, Refresh Elements, Refresh Report Server.
On CU7, MS have introduce "Refresh Report Server". This one, reset SSRS AX metadata caches.

3- Restart Sql Server Reporting Services.
If think, you can avoid this option if you can Reset SSRS AX metadata caches using the Refresh Report Server Cache new CU7 feature.

That's it!