Part One Integrate Ecommerce and Dynamics AX 2012

Wednesday, March 17, 2021

Introduction

If you’re running your business on Microsoft Dynamics AX 2009 or 2012, you are no doubt aware that both software products are approaching the end of their life-cycles. Microsoft is ending Mainstream Support for Dynamics AX 2009, AX 2012, and AX 2012 R2 this year and for AX 2012 R3 in 2021. You can purchase extended support. But be aware that extended support for AX 2009, AX 2012, and AX 2012 R2 ends in 2021. For AX 2012 R3, it will be available until 2023. What are the other options? If Dynamics AX 2009 or 2012 is working well for you and provides all the functionality you need, at a performance standard you like, taking no action is one route you could choose. This set of articles aims to show you that you can keep Dynamics 2012 and still use some of nice new Microsoft tools which are out there to enhance your onpremise Dynamics.

The purpose of the following articles is to review some of these newadditions which Microsoft has introduced to the developer community and how they can be applied to older versions of Dynamics.

Microsoft has introduced the power platform, Microsoft Flow (now power automate), Power Apps and Power BI. The Data gateway another great tool to access data which may not normally be accessible online. These are great tools, but can I take advantage of them if I am running my IT system using older technologies and also running then on my server on-premise.

In the following articles I will aim to take use these new technologies and combine them with AX 2012. We’ll look at using an ecommerce example. I will use an established Ecommerce product called Nopcommerce and wire it up to Dynamics AX using Microsoft Flow. This is a nice product , I could have also used Magento or another shopping cart, but choose this one instead. 

For this example I will using the following technologies

  1. AX Retail Components – Retail Server and Retail Client Sync – These will be part of the solution but I will not go into any great detail other than I will be using part of the finished product, a retail client database which contains all the data I will need for my Ecommerce store. 
  2. Data Gateway – This is a product from Microsoft which allows me to access my on-premise data and allow me to access it in the Flow Platform.
  3. NOPCOMMERCE – The is a .NET based shopping cart. I am going to use the latest version of the product 4.6. This is based on ASP Core. It has an option to use either MYSQL or SQL Server for a database. I will be using SQL Server option.
  4. Power Automate , previously called Microsoft Flow – I will use the power automate tools to take data from one database and sync and transform it to another database. The ecommerce database.
  5. Dynamics AX 2012- I will use this to setup my Retail Online channel and configure the data to move to the Retail Client and thereafter Ecommerce platform.

Setting Up the Example

Before we can get into setting up the Ecommerce store, we need to set up the following

  1. Setup the Retail Sync Client and Server Components
  2. Install the Data gateway
  3. Install our Ecommerce store

Retail Components and the Channel Database Dynamics AX 2012

For the purposes of the article, I will use a pre-configured RetailContosoStore on the demo AX Machine. If you have the demo version of Dynamics 2012 virtual machine. This is already setup and configured. I will be taking the RetailContosoStore channel database for my product and category information.

Retail in Microsoft Dynamics AX 2012 R3 includes starter stores that you can customize: the Contoso store that sells electronics and the Fabrikam store that sells clothing. The shopping cart of the solution is built on the Microsoft SharePoint Server 2013 cross-site publishing platform. Source code and sample customizations for the starter stores are included in the Retail SDK.

For this example, I will be using the Channel database and replacing the SharePoint Ecommerce store with my own Ecommerce solution. In this case I will be using NopCommerce but you could use any other ecommerce solution like Magento.

The Async Server is set up on the VM and Async Client for data distribution in Microsoft Dynamics AX for Retail R3. Commerce Data Exchange: Async Server is part of the asynchronous system that shares data between the Microsoft Dynamics AX database and channel databases.

Async Server is installed at headquarters and communicates with Microsoft Dynamics AX. In addition to Async Server, Commerce Data Exchange includes Commerce Data Exchange: Async Client, which is installed at channels and communicates with the channel database.

For this article I will use the RetailContosoStore. It already has the Retail Categories and Products congfigured in the online channel database. I will use this channel data to sync over to the Ecommerce Store.

Commerce Data Exchange is a system that transfers data between Microsoft Dynamics AX and retail channels, such as online stores or brick-and-mortar stores.

The database that stores data for a retail channel is separate from the Microsoft Dynamics AX database. A channel database holds only the data that is required for retail transactions. For a brick-and-mortar store, the channel database is also known as a store database and is typically located on the premises.

Master data is configured in Microsoft Dynamics AX and is distributed to channels. Transactional data is created in the point of sale (POS) system or the online store, and is then uploaded to Microsoft Dynamics AX. Data distribution is asynchronous. In other words, the process of gathering and packaging data at the source occurs separately from the process of receiving and applying data at the destination.

Asynchronous data exchange

The following illustration shows an overview of asynchronous data flow through Commerce Data Exchange.

If you look at the diagram above, I will be taking the Channel database as the source of information for the Ecommerce Store. This is where I will get the information for my Ecommerce store.

For this article I will be selecting product and category information from the Contoso channel database. 

Download and install a standard gateway

For the next part of the solution, we need to install the Data gateway. This needs to be installed on a server on premise. I will be installing it on the test database server but it is better practice to installed this on a separated application server.

Because the gateway runs on the computer that you install it on, be sure to install it on a computer that's always turned on. Ideally this is on a networked server which has a good network connection as it is responsible for transferring data from the on-premise database to the power platform.

Follow the step here

  1. Download the standard gateway from Microsoft.
  2. In the gateway installer, keep the default installation path, accept the terms of use, and then select Install. Once started the following dialog is displayed
  3. Enter the email address for your Office 365 organization account, and then select Sign in.  This is important I am using the same email which I will be logging into Microsoft Flow.

 Note

You need to sign in with either a work account or a school account. This account is an organization account. If you signed up for an Office 365 offering and didn't supply your work email address, your address might look like nancy@contoso.onmicrosoft.com. Your account is stored within a tenant in Azure AD. In most cases, your Azure AD account’s User Principal Name (UPN) will match the email address.

The gateway is associated with your Office 365 organization account. You manage gateways from within the associated service.

You're now signed in to your account.

  1. Select Register a new gateway on this computer > Next.
  2. Enter a name for the gateway. The name must be unique across the tenant. Also enter a recovery key. You'll need this key if you ever want to recover or move your gateway. Select Configure. For this example, I will be using FeelyConsultantsServer,
  3. Review the information in the final window. Because this example uses the same account for Power BI, Power Apps, and Power Automate, the gateway is available for all three services. Select Close.

And that sthe data gateway installed , very simple to install but an incredibly powerful tool. Using this lovely peice of software all the database servers one premise and now accessible online. The power platform now can access this information. Now lets see if it has been installed correctly.

Navigate to the Microsoft flow online. Login with the same email which you have registered on the data gateway. Navigate to the data option on the left hand side and there is the registered datagateway.

Installing the Ecommerce Solution

Next part of the puzzle is the Shopping Cart. To install nopCommerce on Windows you should download it first. Go to download page and choose the Package without source code version for Windows. This is a pre-compiled version of nopCommerce that can simply be uploaded to your hosting provider and used immediately.

I downloaded version 4.6 version of NopCommerce which is based on ASP Core

Create a database

Before running nopCommerce create a new database instance on your server. This database will be used to store your website data.

We will use the name, server name (or IP, URL), user login and password of your database during the installation process later. These credentials are required for the database connection.

Create a new website

Create a new website on your IIS webserver. Then find a url which allows you to access this site. Copy all the downloaded files to the webserver.

Create a new Ecommerce Store

Using the url from the previous step access the website from your browser. Once you open the site for the first time, you will be redirected to the installation page, as follows:

In the Store information panel fill the following details:

  • Admin user email: this is the email address for the first admin of the site.
  • Admin user password: you will need to supply a password for the admin account.
  • Confirm the password: confirm the admin user password.
  • Create sample data: check this checkbox if you would like sample products to be created. This is recommended so you can start working with your site before adding any of your own products. You can always delete these items later, or unpublish them so they no longer appear on your site.

In the Database information panel you need to enter the following info:

  • Database: here you can select either Microsoft SQL Server or MySQL. Choose the first one if you installing nopCommerce on Windows.
  • Create database if it doesn't exist: it is recommended that you create your database and database user beforehand to ensure a successful installation. Simply create a database instance and add the database user to it. The installation process will create all the tables, stored procedures, and so on.
  • Enter raw connection string (advanced): check this checkbox if you want to enter a Connection string instead of filling the connection fields.
  • Server name: this is the IP, URL, or server name of your database. Get your server name from the hosting control panel.
  • Database name: this is the name of the database used by nopCommerce. If you opted to create your database ahead of time, use the name you gave your database here.
  • Use integrated Windows authentication: if you are installing at a hosting provider, you don't need to use this option.
  • SQL Username: enter your database user login.
  • SQL Password: ener your database user password.
  • Specify custom collation: this is an advanced setting and should be left unchecked.

Click Install in order to start the installation process. When the setup process is complete, your new site's home page is displayed.

That’s it from a setup perspective. We have our components configured. Setting up the retail components is something you could write a whole series of article on, and there is plenty of information out there on this part of the process. Maybe in a later article I will walk through this process. 

We have an ecommerce store but it’s empty let’s make it a little more useful and move some data from our Retail Channels to the Ecommerce store.

In the next artcle we will continue with the installation and set up some addtional SQL scripts on our Retail Channel database and also one the shopping cart side. After we can start to sync data from our channel database to our Ecommercestore