Monday, December 2, 2019

The command-line parameter -compressionminsize=1024 is invalid.

While starting AX client, you may face error as below.

Error "The command-line parameter -compressionminsize=1024 is invalid."


Reason & Solution

One of the reason for this error is, you are using AX server configuration file.

Create new client configuration file using "Client configuration" utility, which should work fine.

Also, let me know, if you find any other Reason/Solution for this error.

Monday, May 6, 2019

Duplicate records in Dynamics 365 Operations using X++


Example below can be used as sample code to find duplicate records from table using X++, either in AX 2012 or Dynamics 365 for finance and operations.

static void rdWrkCtrValidationDupRecords(Args _args)
{
    rdWrkCtrValidation  wrkCtrValidation;

    while select count(RecId) from wrkCtrValidation
        group by wrkCtrValidation.WrkCtrId
    {
        if(wrkCtrValidation.RecId >1)
        info(strFmt('%1 - %2',wrkCtrValidation.WrkCtrId, wrkCtrValidation.RecId));
    }

}

Query in SQL for similar requirement.

SELECT

    WRKCTRID,OUTPUT,COUNT(*)
FROM
    rdWrkCtrValidation
GROUP BY
    WRKCTRID,OUTPUT
HAVING
    COUNT(*) > 1
    



Tuesday, April 30, 2019

Address column Formatting in LogisticsPostalAddress table AX 2012


Issue/behavior

We have noticed that some of the records in table LogisticsPostalAddress column Address stores actually %1 instead of Country/Region.

If we review Address column using table browser, we might not able to notice this behavior due to PostLoad method on LogisticsPostalAddress table.

To review this, either comment method below in PostLoad method or review using SSMS.
DirUtility::replaceAddressToken(this);

What can be the issue due to this behavior?

1. When we are using this field for the integration, this will pass on %1 to other system.
2. To Print address on reports, if we are using bulk operation (Insert_Recordset) instead of row by row (while select) operation, it will show %1 on report/print.

Can we handle this behavior without code? - Yes

When we have selected Expand option in address format – DAX will store %1 instead of Country/Region in Address column of LogisticsPostalAddress address. 
BUT
If we have not selected Expand option in address format – DAX will store Country/Region Code instead of %1. i.e. CA instead of CANADA, so wherever we refer this field it will pass on CA instead of CANADA



Let me know, if you have any more inputs for the same.



Wednesday, April 17, 2019

AX 2012 Form flickering issue


One of our customers was facing an issue with Sales order page flickering issue in AX 2012 RTM.

As per Microsoft support teams’ suggestions, they suggested to upgrade it to Latest application and Kernal version to solve the issue. As we were not convinced to upgrade due to this issue only.
So, I was searching for an solution and come across following useful links,

In our case we changed Tab Page style from Fast tabs to Tabs helped us to solve the issue.

Before:

After:




Thursday, April 11, 2019

Print call stack in infolog AX 2012

Below piece of code can be used to print call stack.

In case of exception/error, we can put this piece of code just before a code which is causing issue.

info(con2Str(xSession::xppCallStack()));



Execute SQLStatement in AX 2012


Below is code example to demonstrate that, SQL queries can be directly executed from AX 2012 to improve performance in some cases.

str sqlStatement = strFmt(@"
    IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = N'dbo' AND TABLE_NAME = 'ModelElement')
    BEGIN
        CREATE TABLE [dbo].[ModelElement](
            [ElementType] [int] NOT NULL DEFAULT (0),
            [RootHandle] [int] NOT NULL DEFAULT (0),
            [ParentHandle] [int] NOT NULL DEFAULT (0),
            [ElementHandle] [int] IDENTITY(1,1) NOT NULL,
            [Name] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT (''),
            [AxId] [int] NOT NULL  DEFAULT (0),
            [ParentId] [int] NULL  DEFAULT (0),
            [Origin] [uniqueidentifier] NULL,
            [PartOfInheritance] [INT] NOT NULL DEFAULT (0),
            CONSTRAINT [PK_ModelElement_ElementHandle] PRIMARY KEY CLUSTERED
            (
                [ElementHandle] ASC
            ),
            CONSTRAINT [I_ModelElement_ElementId] UNIQUE NONCLUSTERED
            (
                [ElementType] ASC,
                [AxId] ASC,
                [ParentHandle] ASC,
                [Name] ASC
            ),
            CONSTRAINT [I_ModelElement_ElementName] UNIQUE NONCLUSTERED
            (
                [ElementType] ASC,
                [Name] ASC,
                [ParentHandle] ASC
            )
        )

        CREATE UNIQUE INDEX I_ModelElement_NameOrderList ON [dbo].ModelElement( ParentHandle, ElementType, Name )
        INCLUDE ( AxId )

        --    CREATE INDEX I_ModelElement_HandleOrderList ON ModelElement( ParentHandle, ElementType, AxId )

        CREATE UNIQUE INDEX I_ModelElement_ParentHandle ON [dbo].ModelElement(ParentHandle, ElementHandle)

        CREATE NONCLUSTERED INDEX [I_ModelElementRecursions] ON [dbo].[ModelElement]
        (
            [ParentHandle] ASC,
            [ElementHandle] ASC,
            [ElementType] ASC
        )
        INCLUDE
        (
             [AxId],
             [Name]
        )

        CREATE NONCLUSTERED INDEX [I_ReadHeaderExt] ON [dbo].[ModelElement]
        (
            [ElementType] ASC,
            [ParentHandle] ASC,
            [AxId] ASC
        )
        INCLUDE (
            [ElementHandle],
            [Name],
            [Origin]
        )

        CREATE NONCLUSTERED INDEX [I_RootHandle] ON [dbo].[ModelElement]
        (
            [RootHandle]
        )

        CREATE UNIQUE INDEX [I_ModelElement_Id1Id2] ON [dbo].[ModelElement] (ElementType, ParentId, AxId)
        WHERE (ParentId <> 0 AND AxId <> 0)
    END
    ELSE
    BEGIN
        DELETE FROM ModelElement;
    END");

    Connection  sessionConn = new Connection();
    Statement   statement = sessionConn.createStatement();

    new SqlStatementExecutePermission(sqlStatement).assert();

    statement.executeUpdate(sqlStatement);
    CodeAccessPermission::revertAssert();

Wednesday, April 10, 2019

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence.

1. Create new Upgrade project in Dynamics LCS.

2. Create VSTS Project and connect it with LCS Project.

3. Upload model store to generate generate Upgrade analysis report.

4. Upload model store to generate Code upgrade reports and get upgraded code.

5. Setup System Diagnostics to get an more idea about current environment and report to help in upgrade process. Link
This report will be accessible by link below, where last numbers are LCS Project Id
https://diag.lcs.dynamics.com/UpgradeAnalysisReport/Report/1350890 

6. Create Project Plan using inputs above.

Generally, This project consist of following phases.
Currently we have started with 1st activity Code upgrade, i will keep this post updated, as and when it is required.

A. Code upgrade.
   1. Decide where to deploy environment.
  • If customer has purchased licenses, we can use their Build and Test environment to start code upgrade.
  • Deploy in Partner LCS account using MS Azure subscription.
  • Download local VM from LCS.
   2. Connect D365 FO VM to the VSTS Project to get upgraded code to work on further    and complete code upgrade.

B. Data upgrade
  • Install hotfix to get Pre-upgrade checklist, review and complete checklist - Link

C. UAT

D. Pre-Go Live activities - Link

E. GO Live

F. Post Go Live Support.

Reference Links.
1. Microsoft documentation - all about upgrade from AX 2012 to Latest D365 FO. - Link


Things to review before estimate an upgrade efforts.
1. Latest CU must be installed in AX 2012 environment - Recommended by MS at Link
Click here to check latest available CU update for AX 2012 environments.

Wednesday, March 20, 2019

Update SQLDictionary table AX 2012

Use below sample queries to update SQLDICTIONARY table to resolve field id conflict in AX 2012.

select * from SQLDICTIONARY where TABLEID = 0

select * from SQLDICTIONARY where TABLEID = 0 and NAME = 'XYZ'

select * from SQLDICTIONARY where TABLEID = 0 and FIELDID = 0

update SQLDICTIONARY
set FIELDID = 0
where TABLEID = 0 and NAME = 'XYZ'

Thursday, March 14, 2019

AX 2012 report deployment error network path was not found

Error:
An error occurred: The network path was not found. If User Account Control (UAC) is enabled on the machine, close the application, and then click Run as Administrator


The deployment was aborted. You do not have privileges to deploy to server. For deployment, you must have administrator rights to the SQL Server Reporting Services (SSRS). Contact your administrator to deploy.

Solution 1 disable UAC
Change following registry key value from 1 to 0.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system 
EnableLUA 
REG_DWORD change value of this key from 1 to 0 to disable UAC

Solution 2
User does not have administrator rights on reporting services and/or on server where reporting services installed.

Solution 3
"Remote registry" services not running on reporting server.

Solution 4
In case of load balancing reporting services refer link - reference

Solution 5

In case you are deploying reports using PowerShell, use option SkipReportServerAdminCheck as below.

For All Reports : "Publish - AXReport -ReportName * -SkipReportServerAdminCheck"
For Single Report : "Publish -AXReport -ReportName CustTransList -SkipReportServerAdminCheck"

Solution 6
In case static IP is assigned to developer PC, remove default gateway & alternate  dns, can also help to solve this error.

Please let me know, if this helps you.
Also, comment if you have any other solution for the same.

Tuesday, March 12, 2019

Clear cache with code X++ Dynamics 365/AX 2012

Code below can be used to clear caches for Dynamics 365 for Operations as well as AX 2012.

In AX 2012, copy and past code below into Job to execute and clear cache.

In D365 create runnable class as below, set that class as startup object for the project, set that project as startup project for the solution and execute class.

class RunnableClassTest
{       
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        xSession::removeAOC();
        SysTreeNode::refreshAll();
        SysFlushDictionary::main(null);
        SysFlushAOD::main(null);
        SysFlushData::main(null);
        //SysBPCheckAIFDataObject::flushCache(true); // only for AX 2012
        SysFlushReportServer::main(null);
        SysFlushSystemSequence::main(null);
        xSession::updateAOC();
        info("Executed.");
    }

}

Monday, March 11, 2019

Expression in query ranges example Dynamics 365/AX 2012


Override form lookup method along with OR condition in query range.

public void lookup(FormControl _formControl, str _filterStr)
{
    //super(_formControl, _filterStr);
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation),_formControl);
    Query query = New Query();
    QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
    QueryBuildRange queryBuildRange;
    ;

    sysTableLookup.addLookupfield(fieldNum(InventLocation, InventLocationId));
    sysTableLookup.addLookupfield(fieldNum(InventLocation, Name));
    sysTableLookup.addLookupfield(fieldNum(InventLocation, InventSiteId));

    queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation, RecId));
    queryBuildRange.value(strFmt('((InventLocationType == %1) || (InventLocationType == %2))',
                            any2int(InventLocationType::Standard),
                            any2int(InventLocationType::Transit)));
  
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

Saturday, March 9, 2019

Dynamics 365 for Operations On-premise installation/Troubleshooting

I will keep updating this post with the helpful links for the installation and troubleshooting D365 for Operation on-premise version.

Install D365 On-Premise PU 12:
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/setup-deploy-on-premises-pu12

Redeploy on-premise environment: Failed status.
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/redeploy-on-prem

Setup Network Printer for On-Premise environment.
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/analytics/install-network-printer-onprem

Troubleshooting:
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/troubleshoot-on-prem



Errors and solutions while installing On-Premise D365 for Operations
ADFS Configuration error:
https://allaboutax.blogspot.com/2018/12/adfs-configuration-error-invalid-scope.html

Deploy AX 2012 R3 environment on Azure

AX 2012/Dynamics 365 operations Performance monitoring related links.

To troubleshoot performance of AX 2012 or Dynamics 365 operations, i am collecting some helpful links on this post.

I will keep updating this blogs as and when required accordingly.

Performance monitoring:

https://blogs.msdn.microsoft.com/axinthefield/ax-performance-monitor-101-setup-perfmon-for-continuous-monitoring-with-rolling-files/

Disk:
https://blogs.technet.microsoft.com/josebda/2014/10/13/diskspd-powershell-and-storage-performance-measuring-iops-throughput-and-latency-for-both-local-disks-and-smb-file-shares/

https://blogs.msdn.microsoft.com/axinthefield/assessing-your-disk-performance-and-your-needs-collecting-relevant-data-part-1/

https://blogs.msdn.microsoft.com/axinthefield/assessing-your-disk-performance-and-your-needs-analyzing-collected-data-part-2/

AX 2012

Performance dashboard
https://blogs.msdn.microsoft.com/axinthefield/3-powershell-scripts-for-dynamics-ax-refresh-report-and-monitor/

AX 2012 Forms performance
https://blogs.msdn.microsoft.com/axinthefield/how-to-measure-the-performance-of-the-dynamics-ax-2012-forms/

Client Access log: (how often they are accessing forms)
https://blogs.msdn.microsoft.com/axperf/2011/10/14/client-access-log-dynamics-ax-2012/

Friday, March 8, 2019

Try catch examples D365/AX 2012

   
Generic try catch example, which will give detailed information about error can be used in AX 2012 as well as D365 for operations.

     try
     {

     }
     catch (Exception::CLRError)
     {
            ex = ClrInterop::getLastException();
            if (ex != null)
            {
                ex = ex.get_InnerException();
                if (ex != null)
                {
                    error(ex.ToString());
                }
            }
    }
    catch (Exception::Error)
    {
        info(ppAutoInventRegister::getErrorStr());
    }
    

    public static server str getErrorStr()
    {
        SysInfologEnumerator enumerator;
        SysInfologMessageStruct msgStruct;
        Exception exception;
        str error;
        enumerator = SysInfologEnumerator::newData(infolog.cut());
        while (enumerator.moveNext())
        {
            msgStruct = new SysInfologMessageStruct(enumerator.currentMessage());
            exception = enumerator.currentException();
            error = strfmt("%1 %2", error, msgStruct.message());
        }
        return error;
    }

Saturday, February 23, 2019

Frequently used functions in D365 operations

Below listed are some frequently used functions in AX 2012, AX 2012 R2/R3, Dynamics 365 operations

1) Print text using label ids.
SysLabel::labelId2String2(literalStr("@DPL1228"))

2)

The clocks on the client and server machines are skewed.

The clocks on the client and server machines are skewed. error reports showing label IDs instead of text.

There was issue after restarting DAX servers, where Microsoft SQL Server Reporting Services (SSRS) reports were showing label IDs instead of text. 

Reviewed event Viewer and looked at Windows Logs > Application to see any related errors. The error was as:

AXRDCE The AXRDCE extension caught an unexpected exception for report CustBasedata.Report.
The error message was:
A call to the Microsoft Dynamics AX SRSFrameworkService service failed. The clocks on the client and server machines are skewed.

Also, while running reports from DAX error was "The clocks on the client and server machines are skewed."

Search results online showed that there was an issue with time synchronization.

To resolve this error, execute command [net time /set /yes] and restarted SQL Server Reporting Services service.

Dynamics ax 2012 Id Conflicts

This content is re-blog of following two posts, through that i got the required info and fixed my issue.

So what is Conflicts ?
If a table ID or field ID is changed in Dynamics AX, data are lost during synchronization, because the table with the old ID (and containing data) is dropped at the beginning and then a new table is created with the same structure but a different ID. The same is valid analogically for table fields.
The data loss can be prevented in several ways (e.g. by data export and re-import), but one solution is really simple and painless. Realize how the situation looks in AX after the ID change (e.g. after installation of a layer with different IDs) but before the database synchronization:
Where Ids are stored in AX ?
You can identify all changed IDs by comparing values in AOT with values in SqlDictionary. And the update of SqlDictionary to the new ID can prevent the regeneration of database objects during synchronization.
ReleaseUpdateDB::changeTableId method is used to updated the SQLDictionary table it takes new and old table id and table name to update the record.
 //Updates table ID in SqlDictionary  
       if (ReleaseUpdateDB::changeTableId(  
         sqlDictionaryTable.tabId,  
         dictTable.id(),  
         dictTable.name()))  
       {  
         info(strFmt("Table ID changed (%1 -> %2)", sqlDictionaryTable.tabId, dictTable.id()));  
       }  
Sometime there is also the need of updating the table id and reflect in the metadata.
There is a Table with name “ModelElement” in AX model database. In this table we have few important fields as, it is important for us to understand these fields.
1. ElementType : this field contains type  ID of data object like for table fields its value will be 42 and for tables it will be 44.
2. AxId : this field contains actual object ID value which create conflicts among environments. We have to change this field value, e-g for AccountNum field of CustTable it could be as 1.
3. ParentId : this field contains parent object ID, like ID of the table, whose field we are looking at, e-g for AccountNum field of CustTable it could be as 77, which is table ID for CustTable.
I have build this query to check the table ids using sql.
 // this query can be used to read the current table id from model db  
 SELECT ELEMENTHANDLE, ROOTHANDLE, NAME, AXID, ORIGIN FROM MODELELEMENT   
 JOIN ELEMENTTYPES ON MODELELEMENT.ELEMENTTYPE = ELEMENTTYPES.ELEMENTTYPE  
 WHERE NAME IN ('legCustTableLegacy', 'legACCCreditLimitLevelLine', 'legAccountsParameterSetup', 'legAXEnums') AND ELEMENTTYPENAME IN ('TABLE')  
 
//This query can update the table id and reflect in meta data.  
 Update M  
 SET m.AxId = 105871  
 FROM MODELELEMENT as M  
 JOIN ELEMENTTYPES ON M.ELEMENTTYPE = ELEMENTTYPES.ELEMENTTYPE  
 WHERE NAME IN ('legACCCreditLimitLevelLine') AND ELEMENTTYPENAME IN ('TABLE')  
Thanks for reading this
Happy Daxing 

Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now