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.");
    }

}

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