Monday, December 8, 2014

AX 2012 DIXF Service is unavailable or The client and service bindings may be mismatched

Hi Guys

If during the Data Import Export Framework validation parameters, you faced the errors :

1- DIXF Service is unavailable

Or

2- System.ServiceModel.ProtocolException: Content Type application/soap+xml; charset=utf-8 was not supported by service http://Servername:7000/DMFService/DMFServiceHelper.svc.  The client and service bindings may be mismatched. ---> System.Net.WebException: The remote server returned an error: (415)......


You have to :

1- Unistall the DIXF AOS Component and reinstall it.
During the installation you will be able to specify the server name where Integration Services is Up & Running

2- Go through the Bin folder of the AOS Server, locate and edit the file Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config, set the endpoint address as :
Practically specify the Server where Integration Services is running.

More info at http://technet.microsoft.com/en-us/library/jj225595.aspx

Stay tuned!


Sunday, October 12, 2014

Dynamics AX issue ? No problem...

Hi All

In our job, often we have faced some errors or strange behaviors.
Also, often I seen a wrong approach about on figure out the issue.

In many case, the developers try to figure out the issue using debug.
In complex scenarios, the debug approach can take a lot of time and sometime not produce any result.

From my point of view, when we face an issue, the steps are:

1-  Check if there is already a hotfix provided by Microsoft using Lifecycle Services, https://lcs.dynamics.com, especially Issue Search.

2-   Search or post a question on the Microsoft Dynamics AX Community, https://community.dynamics.com/ax/f/33.aspx
      Here you can work with many people that probably have already faced your issue and that can help in the right way to solve.
      Additionally, on MS AX Community you will have the pleasure to work with people that have a lot of seniority on Dynamics AX, both Technical that Functional.

3-   Raise a case on Microsoft, https://mbs2.microsoft.com/support/newstart.aspx
Often, the Microsoft reply is very quick if found the issue in their internal database.
Otherwise, is needed some days just to replicate the case on their environment and provide you the relative hotfix.
Finally, you have the opportunity to help Microsoft to improve Dynamics AX and so have a product more stable for other Customers.

4-  Lastly, before debug, involve your functional colleague just to figure out if the issue can be related to a wrong setup.

Finally, if you have in mind something that could improve the product, submit your suggestions using Microsoft Connect, http://connect.microsoft.com/dynamicssuggestions

Speak soon!


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

Enjoy!

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

Enjoy!

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 http://xxx.xxx.xxx.xxx:8101/DynamicsAx/Services/ODataQueryService/

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

Greetings!

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.

http://mvp.microsoft.com/en-us/mvp/Denis%20Macchinetti-5000776

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 :
http://technet.microsoft.com/en-us/library/gg731894.aspx

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!

 

Sunday, March 2, 2014

Dynamics AX - SSRS and SSAS in the field

Hi

In this post i want share some useful links and tips about using SQL Server Reporting Services (SSRS) and SQL Server Analysis Services (SSAS) with Microsoft Dynamics AX.

Microsoft Dynamics AX 2012 R2 White Paper: Business Intelligence Capabilities and Tools.
Here is explained very well the BI Core concept, available BI tools and many others :
www.microsoft.com/.../details.aspx

Resource page for SSRS and SSAS integration in Microsoft Dynamics AX 2012.
Here you can find Featured videos, news introduced in the last Cumulative Update, Common problems and solutions, etc :
Resource page for SSRS and SSAS integration in Microsoft Dynamics AX 2012

The following link describes the types of reports that you can create by using the reporting and analytical features of Microsoft Dynamics AX :
Types of reports [AX 2012]

In few words, Microsoft Dynamics AX 2012 R2 includes a powerful BI solution, including 45 pre-built Role Centers.
Together with SQL Server 2012 and other Microsoft BI technologies such as Excel 2013, Microsoft Dynamics AX 2012 R2 offers a comprehensive set of BI capabilities and tools that can be used to tailor the pre-built content to the specific needs of an Organization.

Stay on touch!

 

Saturday, March 1, 2014

How to Setup Date Format on AX SSRS Report

Hi

If you want to setup a different Format Date on a SSRS report, you can follow the below options:

1- Modify date format for all date textbox present in the SSRS Report using the Format function, like =Format(Fields!TransDate.Value, "dd/MM/yyyy")

2- If you want follow the User Timezone, for all date textbox you can use ConvertUtcToAxUserTimeZoneForUser method, like =Microsoft.Dynamics.Framework.Reports.DataMethodUtility.ConvertUtcToAxUserTimeZoneForUser(Parameters!AX_CompanyName.Value, Parameters!AX_UserContext.Value, =Fields!TransDate.Value, "d", Parameters!AX_RenderingCulture.Value)

Or

=Microsoft.Dynamics.Framework.Reports.BuiltInMethods.ToDisplayStringDate(Parameters!AX_RenderingCulture.Value, Date Field value, "d")

More details at https://technet.microsoft.com/en-us/library/dn275971.aspx?f=255&MSPPError=-2147217396

Enjoy!

SSRS - AX Users are unable to print any SSRS report

Hi

If some AX users are unable to print the SSRS Reports, try to follow the follow tips :

1- Delete the AUC files from the Business Connector user ( from the SSRS Server ).Take care to Stop reporting services before.
E.g. C:\Users\BCUSER\AppData\Local\

2- You will have to make sure that non admin users have sufficient access to browse the reports.
Is enough to add the Domain Users group on SSRS Report Folder and grant the DynamicsAXBrowser role.
E.g. go through http://ax2012r2a/Reports/Pages/Folder.aspx?ItemPath=%2fDynamicsAX&ViewMode=List, Click on Folder Setting, Security. The same also for the StaticReports Folder
More info at technet.microsoft.com/.../hh271484.aspx

3- Setting the Reporting Services Execution Account to the same user as the Dynamics AX Service Account.
Go through Reporting Services Configuration, Execution Account "tab".

Enjoy!
 

Dynamics AX - Per User Session Bandwidth ( WAN Connections )

Hi followers
 
What should be the per User Session Bandwidth for WAN AX connections?
 
The answer is :

- At least 40 kbps per user, for Remote Desktop connections
- At least 200 kbps per user, for AX Rich Client connections

The latency must be less than 5 ms.

Also, consider to compress data between clients and AOS.
Compress data between clients and an AOS [AX 2012]
 
That's it!

 

Friday, February 28, 2014

Query Range Condition - Removing preceeding whitespace

Hi

If you have a query and do you want filter a value where there is a initial whitespace, like " XXXX", you have to use QueryValue(..) method.

So, QueryValue(" XXXX");

If you don't use this method, the initial whitespace is being removed and the query range doesn't work.

That's it!
 

Wednesday, February 26, 2014

Caching display method

Hi


ON AX 2009 :

Add this line code in the FORM method init
Source :
http://ax-dynamics.blogspot.it/2007/08/caching-of-display-methods.html


Public void init()

{

     super();

     this.cacheAddMethod(tablemethodstr(,
), [_updateOnWrite]);  

}

 

ON AX 2012 :

Add this line code in the DISPLAY method before the declaration


 
[SysClientCacheDataMethodAttribute([_updateOnWrite])]

Display type DisplayMethodname(Parameter)
{...}

You can also use FormDataSource.cacheAddMethod(..) that support also Edit Method.


More info on :

Optimizing display methods in AX 2012
Display/Edit method caching


That's it!

 

Wednesday, February 19, 2014

Import Label files ( ALD ) script, using SysLabelFile class

Hi

If you have to import many Label files in different languages into AX 2012, you can use the script below.
If the label file doesn’t exists, it will be created at the current level.
This operation will overwrite any existing label different from file.


    str             path = @"C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\Application\Appl\Standard\";
    container       files = ["axXXX","axYYY"
                                ];
   
    container       extensions = [ "en-us.ald",
                                   "en-gb.ald",
                                   "it.ald",
                                   "fr.ald",
                                   "fr-be.ald",
                                   "de.ald",
                                   "es.ald",
                                   "zh-cn.ald" ];
   
    FilenameOpen    file;
    #WINAPI
    int             i;
    int             j;
   
    SysLabelFile    labelFile;
   
    for(i=1; i<=conLen(files); i++)
    {
        for(j=1; j<=conLen(extensions); j++)
        {
            file = path + conPeek(files, i) + conPeek(extensions, j);           
           
            if( WinAPI::fileExists(file)) // check file exists
            {
                // In AX 2012 there are 2 files for chinese, so we copy(overwrite) the old file in the user desktop with the new name                
                if( conPeek(extensions, j) == "zh-cn.ald")
                {                   
                    WinAPI::copyFile(file, WinAPI::getFolderPath(#CSIDL_DESKTOP) + @"\" + conPeek(files, i) + "zh-hans.ald", true);                   
                    file = WinAPI::getFolderPath(#CSIDL_DESKTOP) + @"\" + conPeek(files, i) + "zh-hans.ald";
                }
               
                // create from file
                labelFile = SysLabelFile::newFilename(file);
                labelFile.fromFile(file);                                   
            }
            else               
                warning(strFmt("File %1 not found", file));        
        }
    }

That's it!

 

Sunday, February 16, 2014

AX 2012 SSRS Improve Performance - PART I

Hi

By using the execution log tables in the ReportServer database, an administrator can determine the run times of reports.

The following query provides the total time, data retrieval time, processing time, rendering time, Report Definition Customization Extension (RDCE) snapshot generation time, and more for every time that a report has run.

SELECT
e.timestart,
DATEDIFF(ms, e.[timestart], e.[timeend]) AS [TotalTime],
e.[timedataretrieval] AS [DataRetrievalTime],
e.[timeprocessing] AS [ProcessingTime],
e.[timerendering] AS [RenderingTime],
COALESCE ([AdditionalInfo].value('(/AdditionalInfo/RdceSnapshotGenerationTime//node())[1]', 'int'), 0) AS [RDCESnapshotGenTime],
e.*
FROM
[executionlog2] AS e
--WHERE e.[timestart] BETWEEN @basedate AND DATEADD(hh,25,@basedate)
ORDER BY 1 DESC;

The column of interest would be TimeDataRetrieval, TimeProcessing, TimeRendering.
Here is some site where you can analyse your results:

ExecutionLog2 View - Analyzing and Optimizing Reports

Report Server Execution Log and the ExecutionLog3 View

SQL 2008 R2 RTM! Time to look at some new Execution Log Reports
 


That's it!

 


AOT Query - Set range using "variables"

Hi

If you want to set variable ranges on AOT query, you can use SysQueryRangeUtil class. You can use existing methods there or create your own.

http://msdn.microsoft.com/en-us/library/cc618616(v=ax.50).aspx

For example, if I have an AOT query with PurchLine as datasource. Then I can add a Range to createdDateTime field with value:

(dayRange(-50,0))

I will only see PurchLine from the past 50 days relative to the session date.

When using SysQueryRangeUtil methods, there should be outer brackets enclosing the method itself.

That's it!
 

Saturday, February 15, 2014

Delete Huge Dynamics AX Log Tables

Hi

In the last days, I analyzed a Customer Database that grew up very fast.

The top tables was :
1- AIFResponse
2- AifMessageLog
3- SalesParmLine
4- BatchJobHistory
5- InventSumLogTTS

For the first two tables, related the AIF Interface log, I have build a script to run on SQL Server side.

Use DatabaseName

DECLARE @continue INT
DECLARE @rowcount INT  
SET @continue = 1
WHILE @continue = 1
BEGIN    
 PRINT GETDATE()    
 SET ROWCOUNT 10000    

 BEGIN TRANSACTION    
 DELETE FROM Table where CREATEDDATETIME < '2014-01-01'
      )

 SET @rowcount = @@rowcount     
 COMMIT    
 PRINT GETDATE()    
 IF @rowcount = 0    
 BEGIN        
  SET @continue = 0    
 END
END

For the SalesParmLine table that stores temporary sales order line entries when a sales order is posted, I run the clean up job on Menu "XXX/Sales and marketing/Area page/Periodic/Sales update History cleanup"

For the BatchJobHistory table, I have open the Batch Job History form and delete all ended Job

About InventSumLogTTS table, the delete function is trickered by the setup of the dynamic masterplan, see classes\ReqCalcScheduleItem\InsertItemSched
So to correct the MRP, you need to go to Master Planning/Setup/Master planning parameters Set the current dynamic master plan to the same as the static plan.

Finally, you must perform the Shrink Database.
So, first of all I have set the Recovery Database to Simple, execute the shrink process and change again the Recovery Database to Full.
I have also Stop the AOS before the Shrink process.

Update 1:

Take a look to the link below, in order to Delete huge volume of data on Big Tables.

Concurrency Week: How to Delete Just Some Rows from a Really Big Table

That's it!

Friday, February 14, 2014

List of AX Users security roles

Hi

Below a nice post for have a lists of the AX users and their security roles.

User security role assignment report [AX 2012]

Enjoy!

 

Sunday, February 9, 2014

Moving between Microsoft Dynamics AX 2012 Environments

Hi

It is common practice to restore a Microsoft Dynamics AX database from one environment into another environment for testing and development purposes.

More informations on the link below

Moving between Microsoft Dynamics AX 2012 Environments

Enjoy !

 

Friday, February 7, 2014

SQL Server Scripts

Hi

Below some interesting SQL Scripts :

1- sp_who data plus a connection summary and lead blocker details
SP_WHOM

2- This script will help you to get the culprit along with IP address and User name which helps us to determine the Blocking root cause
Figure out the Blocking issue

3- In this script, we can search a Field and Table in all databases on the server, returning the Field value
Search Table And Field In All Database And Return Field Value

4- This script finds the size of all indexes in a database along with the table and the filegroup on which the index resides
Find the size of all Indexes in a database

5- I wrote this query that helps us find executed queries with most number of execution counts. The DMV that we have used in this script is sys.dm_exec_query_stats and the function that we have used is sys.dm_exec_sql_text
Find Top 5 executed queries ordered by execution count

6- Top 5 expensive Queries from a Write IO perspective 
Find Top 5 expensive Queries from a Write IO perspective

7- The below written query helps us find the most expensive queries from a read IO perspective. The DMV that we have used in this script is sys.dm_exec_query_stats and the function that we have used is sys.dm_exec_sql_text
Find Top 5 expensive Queries from a Read IO perspective

8- Script to be executed every 60 minutes as a job to determine long running jobs
Long Running Jobs Monitor

Enjoy!







 

Tuesday, February 4, 2014

Printing Purchase Order to file by code

Hi

Below the code for generate a file ( PDF, Xlsx, etc. ) from a Purchase Order Report.

SrsReportRunController controller = new SrsReportRunController();
PurchPurchaseOrderContract rdpContract = new PurchPurchaseOrderContract();
SRSPrintDestinationSettings settings;

// Define report and report design to use
controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));

// Use execution mode appropriate to your situation
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

// Suppress report dialog
controller.parmShowDialog(false);

// Explicitly provide all required parameters
rdpContract.parmRecordId( VendPurchOrderJour::findRecId(5637146077).RecId );
controller.parmReportContract().parmRdpContract(rdpContract);

// Change print settings as needed
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.fileName(@'\\UNCPATH\test.pdf');

// Execute the report
controller.startOperation();

Enjoy !
 

How to print a report from X++ ( pdf, xlsx, Email, etc. )

Monday, February 3, 2014

Retrieve the format for numeric and date value according to the Culture

Hi

For retrieve the format for numeric and date value according to the Culture you can use the class RetailENInfo methods formatDatetimeData or formatNumericData.

e.g. :

    TransDate       dateLocal;
   
    dateLocal = 22\08\2014;

    info ( queryValue( RetailENInfo::formatDatetimeData( dateLocal, "EN-US") ) ) ;

    Result : 8/22/2014

Enjoy!

Friday, January 10, 2014

AX 2012 - CIL Compilation ISSUES


Hi All
 
Sometimes CIL Compilation take a lot of time and sometime freeze.

Often this occur because there are some batch running or some users that are running some process that use CIL Objects, etc.

In these situation, the DLL are locked and so CIL go in hang.

The best practices about CIL Compilation, is execute in a non-peak hour because during CIL Compilation AIF Services are stopped, so :
 
1-      SSRS Report doesn’t work

2-      Office Add-in doesn’t work

3-      Eventually Custom Services ( Integration with WMS, integration with some Web sites, etc. ) doesn’t work

Enjoy!
 
 

Tuesday, January 7, 2014

AX 2012 - Error while setting server report parameters. Error message: The permissions granted to user xxxx

Hi All

When you install the SSRS reports, usually you assign the permission “DynamicsAXBrowser” on folder Dynamics for the AX Users.

Take care, assign the same permission also to the folder StaticReports to avoid permission issues.

Enjoy!

AX 2012 - Call a Class\Method in CIL

Hi

Below the code for call a Class\Method in CIL :

    container               conparm;
    XppILExecutePermission  ilPermission;
    ;
    ilPermission = new XppILExecutePermission();
    ilPermission.assert();
    SysDictClass::invokeStaticMethodIL("test","test",conparm);
    CodeAccessPermission::revertAssert();

Enjoy!