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.

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