Microsoft Dynamics Ax 2012 Custom financial dimensions Lookup

There was a requirement to create a new field on a table that should be populated from a custom financial dimension values and need to show a lookup on the data entry form for this field that will populates the data from your custom financial dimension.

First need to identify the relevant tables that are needed to fulfill this requirement:

  • DimensionFinancialTag
  • DimensionAttribute
  • DimensionAttributeDirCategory
  • FinancialTagCategory

The list of values for custom dimension are stored in the table DimensionFinancialTag. But this table stores custom values for all custom financial dimensions. To determine which of the records to filter out and show we will have to apply a filter on the field FinancialTagCategory. How do we figure out the FinancialTagCategory value? We do that by traversing from the DimensionAttribute table (hold a records for your financial dimension).

The table DimensionAttributeDirCategory holds a link between DimensionAttribute and FinancialTagCategory, this table is used to retrieve the financialtagcategory and filter the records in the table DimensionFinancialTag.

Following is the Sample Code:

static void MyCustomFinancialDimensionLookup(Args _args)
{
SysTableLookup                      sysTableLookup;
Query                               query;
QueryBuildDataSource                qbdsDimensionFinancialTag;
QueryBuildRange                     qbrFinancialTagCategory;

#define.MyCustomFinancialDimension(‘MyCustomFinancialDimension’)

query = new Query();
qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag));
qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory));
qbrFinancialTagCategory.value(strFmt(‘%1’, DimensionAttribute::findByName(MyCustomFinancialDimension, false).financialTagCategory()));

sysTableLookup = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), this);
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true);
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory));
sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();
}

Microsoft Dynamics Ax 2012 Inbound port using File system Adapter Error: Duplicate message. Message has already been processed

Yesterday we get the following error during import of XML File containing message ids.

“Event Description: Object Server 01: An error has occurred in the services framework. Method: AifMessageInspector::AfterReceiveRequest. Error: System.ServiceModel.FaultException`1[Microsoft.Dynamics.Ax.Services.AifFault]: Duplicate message. Message has already been processed. (Fault Detail is equal to Microsoft.Dynamics.Ax.Services.AifFault).”

Reason:

XML File contain the message ID’s that were already imported to system.

Solution:

By updating the Message ID’s that were already imported to the system and run the import process it work fine.

Following is the example work around that has been done to fix the issue:

Change the message id value at the end of id. From Message ID.

{5603D03A-4380-404D-9F27-738BE0FEA14F}

To message ID:

{5603D03A-4380-404D-9F27-738BE0FEA18F}

Microsoft Dynamics AX 2012 SSRS REPORT ERROR: a connection attempt failed because the connected party did not properly respond after a period of time.

Error Detail:

After providing parameters and run the report after a while getting following error

“A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond”

Solution1:

  • The reason can be the the AX client config on the report server ,client configurations need to be refreshed (click the refresh button) for both the client config and the business connector config.
  • Run the command prompt as administrator
  • Flush the DNS by using ipconfig /flushdns command.

Solution2:

  • Stop all AOS’s
  • Stop Reporting Service
  • Start AOS
  • Start Reporting Service

Adding worker picture to the WorkerIDCard Microsoft Dynamics AX 2012

Requirement: There is a need to modify the jmgWorkerCard report by adding the worker’s image (HcmPersonImage)

Solution: Image is in the HcmPersonImage table, it only has 2 fields: person and image following code worked in the processReport part of the jmgWorkerCardDP class:

tmpWorkerCard.Image = hcmPersonImage::find(hcmWorker.RecId).Image;

Microsoft Dynamics AX 2012 SSRS Reports Considerations

Things we must remember while working with SSRS reports whether it is customized or new reports from scratch.

  • All servers must be using Microsoft Windows authentication. Depending on the functionality that you implement, Microsoft Dynamics AX may also require that you use domain accounts with specific permissions.
  • When upgrading, existing Reporting Services and X++ reports will be copied to the Microsoft Dynamics AX 2012 system, but they will not be upgraded. We recommend that you use a Reporting Services report that is provided with Microsoft Dynamics AX 2012 as a template and customize it to meet your needs
    • Reports will not be upgraded from Microsoft Dynamics AX 2009 to Microsoft Dynamics AX 2012. Microsoft Dynamics AX 2012 provides hundreds of default, out-of-the-box reports that you can deploy and customize
  • When accessing data from the Microsoft Dynamics AX database
    • use the predefined Microsoft Dynamics AX data sources to ensure that appropriate security is enforced
    • When you use the query and report data provider data source types, all data access requests go through the Role and Task security system
    • When you use an external SQL or OLAP data source, security settings from the Role and Task security system are not applied when accessing data
      • In this case, you can use the role-based security features that are available from Microsoft SQL Server to secure the data.
  • Try to put static debugger (write breakpoint) in DP Class processReport() method.
  • Run the report from visual studio
    • Open Microsoft dynamics AX Configuration Utility -> select developer tab,
      • Select check boxes provided) and debug it.
  • Stress (While Debugging) on query in processReport() methods
    • Because that could also be one of the reason for your problem.
  • Put static debugger in insertIntoTempTable() as well to check whether data is populating in temp table or not, change TableType as regular.
  • Refresh Report, Report Server in Tools-> Caches ->Refresh report server
  • Delete the Report from report Server and redeploy it.
  • Generate Incremental CIL.
    • Full CIl generation (Recommended)
  • Do not build third-party reporting projects from the command line. Build from the command line only in trusted scenarios
    • When building from the command line, Microsoft Dynamics AX reporting tools does not perform any checks for unsafe entries in the project file
    • The project file entries are not analyzed by Microsoft Dynamics AX reporting tools from a security perspective