MCTS: MB6-872 Dynamics AX 2012 Installation & Configuration

Now it’s official, I know how to install Dynamics AX 2012 Smiley

image

On Vacation: Berlin

berlin

Greetings from Berlin!

MCTS: 70-573 SharePoint 2010 Application Development

image

On Friday 13th Smiley I was certified for SharePoint 2010 Application Development. Since every Dynamics AX Silver+ Partner need at least on SharePoint guy, I’m the one for InsideAx. I’m already experienced in maintaining SharePoint 2012 (mainly Foundation) for those of our Customers running Rolecenter in AX 2009. Furthermore I’ve upgraded and developed Enterprise Portal applications in the last two years. However, EP development and classic SharePoint development does diverge. Everybody who ever tried to modify EP using SharePoint designer knows what I’m taking about.

I don’t want to say that all the cool SharePoint features cannot be used to extend Dynamics AX (e.g. I’ve built a web based appointment app using SharePoint and its lists and calendars to visualize the schedules). All those who are now forced to get in touch with SharePoint may experience that it can be used in may cases to provide cool solutions for their customers. But I’d like Microsoft to strengthen the web / enterprise portal development aspect of Dynamics AX by extending the development course materials and provide an Enterprise Portal Certification.

SSRS: Error when opening design of duplicated report

When you duplicate an SSRS Dynamics AX 2012 report in Visual Studio, and you try to open the design node you may get an error message like “object instance not set to an object”. The reason is that the data set parameters contain the name of the report e.g. SalesQuotation. Now that you have duplicated the report its name is CopyOfSalesQuotation and the report is broken.

Broken parameter in duplicated SSRS report

Compiling the report project brings up a list of errors.

Errors when compiling a duplicated report

Navigate to each data set parameter and change the name of the report to match the new name e.g. CopyOfSalesQuotation instead fo SalesQuotation

Broken parameter in duplicated report

The fixed parameter should look like this

Dynamics AX 2012 duplicated report data set parameter

Finally the report designer is working

Dynamics AX 2012 duplicated report in report designer

Dynamics AX 2012 on Windows Server 8 Beta with SQL 2012 RC0

Microsoft recently released Windows Server 8 Beta and Windows 8 Consumer Preview. So my first though was about running Dynamics AX 2012 on Server 8 and Windows 8. However, installing AX 2012 on Server 8 failed due incompatibility with windows installer. But Windows Server 8 and Windows 8 Betas still come with an upgrade option. So I had the idea install AX 2012 on Server 2008 R2 and upgrade to Windows Server 8 Beta.

Prolog (the IBM x3400 thing)

We’ve bought an IBM x3400 M3 server for a customer. We’re still waiting for some hard disks to deliver, so the server is unused and becomes my testing platform for the moment. Installing Windows 8 Beta was straight forward, but as mentioned installing AX 2012 failed. So next I failed installing Windows Server 2008 R2 because no hard disk was found (missing driver). The solution:

servers   usb driver

IBM x3400 M3 and Raid driver on USB for Windows Server 2008 R2 installation

Windows Server 2008 R2, SQL Server 2012 RC0

Next I’ve joined the new 2008 R2 server to our domain. Loving Betas, Previews and other unstable stuff I’ve installed SQL Server 2012 RC0 to serve as database server for AX.

  • Installed .NET Framework 3.5.1 Feature using Server Manager
  • Installed .NET Framework 4.0 Full package
  • Installed NDP40-KB2390372-v2-x64 patch for .NET 4.0
  • Installed C++ Runtime Environments from AX 2012 DVD
  • Installed SQL Server Native Client
  • Installed Report Viewer 2012 from AX 2012 DVD
  • Installed Identity Foundation from AX 2012 DVD
  • Installed Open XML SDK for Office from AX 2012 DVD
  • Installed SQL Server 2012 RC0 full featured

    sql sql2

    SQL Server 2012 RC0 Full Featured

    Pizza Break

    Ham, Eggs, Bacon, Onion and Corn, Coke and Tiramisu

    Pizza and Tiramisu

    Admin’s workplace Smiley

    Dynamics AX 2012

    AX on SQL 2012 RC0 is a little bit tricky, because even database creation failed. So I’ve set up an AOS using another SQL Server 2008 R2 with an existing AX 2012 database and baseline. Next I restored an AX 2012 database from a backup in SQL 2012 RC0 and configured the AOS to use it. Works as it should. However, the reporting extensions are not compatible with RC0 and installation failed.Dynamics AX 2012 with SQL Server 2012 RC0

    AX 2012 using SQL 2012 RC0

    Upgrade to Windows Server 8 Beta

  • Installed Windows Server Backup Feature from Server Manager and create a backup
  • Downloaded Server 8 ISO
  • Extracted it and copied it onto an USB stick using xcopy *.* /s/e/f u:\\
  • Started Upgrade from DVD or USB
  • The Upgrade took quite a lot of time until windows was ready

    Windows Server 8 Beta Upgrade

Windows Server 8 Beta Data Center Edition with GUI

Windows Server 8 Beta Upgrade

Upgrade an existing Installation

Windows Server 8 Beta Upgrade

Windows Server 8 Beta is starting up, …

Windows Server 8 Beta Start Screen

Finally! Windows Server was upgraded from 2008 R2 to 8 Beta

Repairing Dynamics AX

Well, Windows as upgraded successfully but Dynamics AX is not working any more Trauriges Smiley Starting the AOS results in an error. Reviewing the windows event error logs brings up the details:

image

Object Server 01:  Error accessing registry: Cannot open key SYSTEM\CurrentControlSet\Services\Dynamics Server\6.01. Error code: 0

Object Server 01:  The directory "C:\Windows\system32\\bin" does not exist or access to it has been denied by the operating system.

Object Server 01:  The home directory for Axapta (C:\Windows\system32\) does not match the required structure or can not be accessed. Please check installation, configuration and access rights.

Object Server 01:  Server terminated unexpectedly with 10 exitcode.

The reason is an missing registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynamicsServer\601

image

I solved this issue by importing an AX configuration from another server’s registry

  • Opened an RDP session to an other 2008 R2 server running an AX 2012 AOS
  • Start > Run > regedit
  • Navigated to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynamicsServer\60
  • Exported the registry key as file (Context Menu > Export)
  • Copied the .reg file the Server 8 Beta desktop and imported it
    There are a lot of settings and paths in the registry, make sure these settings apply to your w8 server
  • Started the Server Configuration Utility and changed the database setting back to localhost
  • Started the AOS
  • Started the Client

Dynamics AX 2012 on Server 8 Beta

Dynamics AX 2012 running on Windows Server 8 Beta

VaMoS 2012 Paper: Managing variability of ERP ecosystems

The paper is about variability in ERP ecosystems, especially the situation of Dynamics AX partner companies. We present an idea how partner companies could manage the variability in their solutions to set up a product line. The paper can be found at the ACM Digital Library

Battle of Nations Monument

Battle of Nations Monument near Leipzig

Use Fulltext Index in AX 2012 to search in RSS feeds

Here is a simple example how to use the fulltext index capability in Dynamics AX 2012. This example downloads RSS postings into a table with fulltext index and runs a query to identify those with specific words.

Create the RssFeedTable

  1. Create a new String Extended Datatype called RssFeedId
  2. Create a new table called RssFeedTable and add the RssFeedId, Name and Uri
  3. Create a primary index based on the RssFeedId
  4. Set the RssFeedTable as Reference at the RssFeedId Extended
  5. Populate the table with data e.g.
    FeedId = technet
    Name = “Technet Austria”
    Uri = http://feeds.feedburner.com/TechnetTeamBlogAustria?format=xml

Create the RssContentTable

  1. Create a new Table called RssContentTable
  2. Add the RssFeedId, Description255 and rename it as Title and a Memo field
  3. Create a fulltext index for the memo field

image image

    Create the RSS Reader Class in C#

    1. Create a new Visual C# class library project for .NET 4.0 in Visual Studio
    2. Add the project to AOT
    3. Copy this code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ServiceModel.Syndication;
    using System.Xml;
    using System.Text.RegularExpressions;

    namespace ErpCoder.RssFeed
    {
        public class Reader
        {
            private string xmlAddress = String.Empty;
            private IEnumerator<SyndicationItem> enumerator;

            public Reader(string address)
            {
                xmlAddress = address;
            }

            public void Load()
            {
                var reader = new XmlTextReader(xmlAddress);
                var feed = SyndicationFeed.Load(reader);
                enumerator = feed.Items.GetEnumerator();
            }

            public bool Read()
            {
                return enumerator.MoveNext();
            }

            public string GetTitle()
            {
                return enumerator.Current.Title.Text;
            }

            public string GetDescription()
            {
                string text = Regex.Replace(enumerator.Current.Summary.Text,
                                             "<(.|n)*?>", String.Empty);
                return text;
            }       
        }
    }

    1. Set the Deployment Target at the project to Client: Yes and deploy

    Populate the RssContentTable

    1. Create a find method on the RssFeedTable
    2. Copy this code and substitute the parameter in the find method with one of yours

    static void populateFeedTable(Args _args)
    {
        System.Exception ex;
        RssFeedTable feedTable = RssFeedTable::find("techat");
        RssFeedContent content; 
        ErpCoder.RssFeed.Reader reader;
        InteropPermission permission;
     
        permission = new InteropPermission(InteropKind::ClrInterop);    
        permission.assert();

        try
        {
            reader = new ErpCoder.RssFeed.Reader(feedTable.Uri);
            reader.Load();

            while(reader.Read())
            {
                content.clear();
                content.Title = reader.GetTitle();
                content.Text = reader.GetDescription();
                content.FeedId = feedTable.FeedId;
                content.insert();
            }
        }
        catch(Exception::CLRError)
        {
            ex = CLRInterop::getLastException();
            error(ex.get_Message());
        }

        CodeAccessPermission::revertAssert();
    }

    Create a job to test the fulltext index

    1. Create a new job and copy this code

      static void queryFullText(Args _args)
      {
          RssFeedContent feedContent;
          Query query = new Query();

          QueryBuildDataSource qbdsContent =
           query.addDataSource(tableNum(RssFeedContent));

          QueryBuildRange rangeText =
           qbdsContent.addRange(fieldNum(RssFeedContent,Text),
                                1,QueryRangeType::FullText);
          QueryRun queryRun;
          rangeText.value("Office Hyper-V");

          queryRun = new QueryRun(query);
          while(queryRun.next())
          {
              feedContent = queryRun.get(tableNum(RssFeedContent));
              info(feedContent.Text);
          }
      }

    2. Subsitute the value of the fulltext range value with yours
    3. Test the query

    image

    Using a Seagate Momentus XT Hybrid HDD to boost performance on a Dynamics AX 2012 presentation laptop

    Momentus XT is a hybrid HDD that combines a 7200rpm drive with a large SSD cache. I’ve bought one to run a  Dynamics AX 2012 presentation laptop. By design the performance is getting better for frequent tasks. Here are my results:

    Testcases:

    1. Boot Windows Server 2008 R2 until STRG+ALT+DEL screen appears
    2. Start Dynamics AX client and wait until role center has finished loading and rendering reports
    3. Post a sales order confirmation with 20 lines

    Laptop: HP 8540w Mobile Workstation, 8GB RAM, Core i7 2,8GHz
    Software: Windows Server 2008 R2 SP1, Dynamics AX 2012 CU1, SQL Server 2008 R2, Enterprise Portal with SharePoint Server 2010

      HDD XT #1 XT #2 XT #3 XT #4 XT #5
    Boot 03:05 03:13 02:36 01:48 01:54 01:46
    Start AX 00:51 00:40 00:31 00:18 00:17 00:18
    Confirmation 02:30 01:40 00:59 00:59 01:07 00:59

    @Dynamics AX Technical Conference

    You can find me at the Dynamics AX Technical Conference in Nice

    Extend SalesTable2Line Framework

    Dynamics AX provides a Framework for updating changes made on SalesTable fields to SalesLine fields. The update method can be configured within Dynamics AX at Accounts Receivable > Setup > Parameters > Updates > “Update order Line”. This form is used to configure if and how changes made to the SalesTable are written to the lines. This framework can be extended to update your own fields, like a “Notes” field in the example below.

    Dynamics AX 2009 Update Order Lines

    1. Create a new field called "SalesNotes” in the SalesTable and SalesLine
    2. Add the SalesTable.SalesNotes field to the Field Group HeaderToLineUpdate at the SalesTable
      Put Sales Notes field HeaderToLineUpdate group in the SalesTable
    3. Display the new fields in the SalesTable form e.g. in the General tab
    4. Open the SalesTable2LineParameters table in the table browser and remove all records. Don’t worry, these data will be populated automatically and is the basis for the “Update order line” form.
    5. Add the following line to the SalesTable2LineField.lineUpdateDescription method

      case fieldnum(SalesTable, SalesNote):
          return fieldid2pname(tableNum(SalesLine), fieldNum(SalesLine, SalesNote));

      Modify the SalesTable2LineField.lineUpdateDescription method

       

    6. Add a parameter method for the SalesNote field to the AxSalesTable class

      public SalesNote parmSalesNote(SalesNote _salesNote = ”)
      {
          if (!prmisdefault(_salesNote))
          {
              this.setField(fieldnum(SalesTable, SalesNote), _salesNote);
          }

          return salesTable.SalesNote;
      }

    7. Add a parameter method for the salesNote field to the AxSalesLine class

      public SalesNote parmSalesNote(SalesNote _salesNote = ”)
      {
          if (!prmisdefault(_salesNote))
          {
              this.setField(fieldnum(SalesLine, SalesNote), _salesNote);
          }

          return salesLine.SalesNote;
      }

    8. Create a setSalesNote method on the AxSalesLine class

      protected void setSalesNote()
      {
          if (this.isMethodExecuted(funcname(), fieldnum(SalesLine, SalesNote)))
          {
              return;
          }

          this.setAxSalesTableFields();

          if (this.isAxSalesTableFieldsSet() || this.axSalesTable().isFieldModified(fieldnum(SalesTable, SalesNote)))
          {
              this.parmSalesNote(this.axSalesTable().parmSalesNote());
          }
      }

    9. Modify the setTableFields method to call the setSalesNote method
      Call the setSalesNote method
      Test your modification. Open the “Update order line” form and set the update method for Sales Notes to “Prompt”. Open the sales order details form, go to your new field, modify the text and save. A dialog will appear and ask your to update the Note fields. Click OK, and review the Sales Notes in the SalesLines.

    Modify the SalesNote value in a sales order

    Review the update on the sales line