Dynamics AX

Welcome to my Dynamics AX playground!

Home     Articles     Dynamics AX - Trivia     Dynamics AX Search     Mohammed Rasheed     Contact Me     My Dynamics Ax Blog      
Guide to Setup SSRS with
Add Fields to a Table Using Code
Code to view Ledger Transaction Details
AX Mobile - Installation and Configuration
Forecasting in Dynamics AX 2009
Multi Threaded Programming in DAX
OLAP - Installation and Configuration
Send Text Messages (SMS) from DAX
Sending Emails from DAX without Outlook.
Using Data Definition Groups
A View Thing..
All About Maps..
COM Class Wrapper
Create a Role Centre
Create and Post Counting
Outlook 07 Integration
Alerts to Multiple Users
Counting Lines of Code

Dynamics Mobile AX – Installation and Configuration (Part 1 of 2)

‘Dynamics AX Mobile’. Need I say more?

Sam Walton [1] once said, “Information is power, and the gain you get from empowering your associates more than offsets the risk of informing your competitor”... if that is true, then basically Dynamics Mobile, Empowers its users!!. Dynamics mobile is tool that gives quick and easy access to information on a mobile device...but it doesn’t stop there, Dynamics Mobile also let its users apply that information to process transactions on a system that could be potentially located in a different country.
I know the quote is ‘slightly’ out of context.. but that is the best I could find .
In all seriousness, Dynamics Mobile is an immensely power platform that uses the latest SQL Server, XML and .Net technologies to integrate with a backend ERP system. Out of the box, it comes integrated with Dynamics AX 4 (sp1 and sp2) and Dynamics NAV.
There is possibly no limit to what one can achieve with this technology, as it literally enables any ax module to be deployed on a mobile device.... hence users can use their mobile devices to create sales order, view stock information, update customer information. It can also be deployed in the warehouse, so picker/packers can use handhelds with Windows Mobile to pick, pack and deliver sales orders....
Mobile Sales for Dynamics AX [2] is currently the only application available from Microsoft (for Dynamics AX), however there is nothing stopping customers or partners from building their own mobile modules.
A feature that caught my attention was that Dynamics Mobile is designed to operate under an ‘occasionally connected’ network. Hence the mobile devices don’t need to be connected to the server, at all time! This could be of huge benefit to sales representatives who visit client sites, as they can now use their mobile device to take an order, give the customer a unique order reference number and also get the customer to confirm the order by signing on the mobile device... even when they are not connected to the company network.

Figure1 :Dynamics Mobile Entry Screen – from Installation and Development Guide in Dynamics Mobile 2008

The order is submitted and created in the ERP system as soon as the mobile client is brought back in network range. Communications between the mobile client and the mobile server can be done on most, if not all network protocols, such as, WIFI, EDGE, GPRS or even by connecting the mobile device to a computer which wired (LAN) to the mobile server.
Architectural Overview:
Dynamics Mobile mainly comprises of 3 components:
1. Mobile Server
2. Mobile Framework
3. Mobile Client
The following illustration, from the MS Dynamics Development Tools White paper depicts the architecture the technology is based on.


Mobile Server:
Mobil Server is essentially a collection on web services, which are designed to act as an intermediary between the mobile client and the backend ERP System (such as Dynamics AX). These web services are fundamentally used for sending and requesting xml documents, along with logging and deployment of documents (covered in more detail in the next article).
The mobile server also holds erp specific integration component, called ‘Mobile Connector’ which contains specialized code to integrated with a specific erp system.
Mobile Client:
Mobile Client is an application that is installed on the mobile devices. Currently, Microsoft Windows 5 and Microsoft Windows 6 enabled pocket pc are supported by the Dynamics Mobile framework.
The 3 core components of a mobile client are:
1. The Roelpad Mobile Application
2. .Net Compact Framework
3. Sql Sever 2005 – Compact Edition.
Having a local database enables the client to optimize data lookup, by caching data locally, hence a part of the ERP data, is stored on the mobile device itself. The local data caching mechanism can be role tailored for a particular hand held device/user (for example customer services reps would frequently access customer data, whereas stock controllers would keep then eyes tuned on item transactional data).
Mobile Framework:
Mobile Framework is a .Net Compact extended environment, that provides a set of managed api, that enables developers to develop/deploy mobile applications that can easily be integrated with an ERP system. A feature that I personally really liked was the frameworks ability to share access to a common resource with a number of tasklets.
Prerequisites:
• The ERP System (Dynamics AX)
• Sql Server 2005 (including SQL Server Integration Services)
• Windows Server 2003 sp2
• .Net Framework 2 or above
• IIS 6
Things to keep in mind:
• Security: think about the users that need access to the AX mobile solution or the mobile application you are developing/deploying. A user group needs to be created, as users in Windows Mobile are authenticated via Active directory. In addition this new user group need to be added to the user group that have read/write access to the mobile database (standing databases).

The Security model that Dynamics Mobile adheres to is not the same as the ERP (Dynamics AX), hence a user might not have access to a particular set of data in the ERP system, but can potentially get access to that data on the mobile device, hence security needs to be very carefully managed. For example, Record level security from Dynamics AX, is not propagated to the Dynamics Mobile server, hence this type of security model as to be explicitly coded in the tasklet or incorporated in sql.

• Infrastructure:
Dynamics mobile uses 3 types of datasets:
1. Deployment
2. Logging
3. Staging
Deployment and logging datasets can be stored of the same database, however depending on the number of mobile users and the rate at which transactions are being passed via a Mobile device, one might want to separate these datasets on 2 different databases (preferably stored on different disk).
The Staging databases holds data that is extracted from the ERP database using sql server integration services, the mobile devices do not directly access the ERP database, but actually query the staging database for information. When deploying Dynamics mobile, one would have to carefully consider the frequency at which data is extracted from the ERP database, as this can have a significant performance impact on both the mobile database and ERP DB.

Do this before running the installation files:
From my experience in installing Dynamics Mobile, I would recommend competing a few task before running the installation files, as this would make the installation process a lot smother..
1. Create the logging and deployment databases:
Logging and deployment databases need to be created manually using sql server management studio. The dynamics ax mobile installer comes with a set of sql scripts that create the required objects in the databases.

For convenience, you might want to you the same database for both logging and deployment




The above illustrations have been taken from the Dynamics Mobile Server Components guide.

Note: I would highly recommend naming the databases (and all other components) as shown the pictures above. The standard dynamics mobile components are defaulted to use these names, hence we won’t have to do a lot of reconfiguration in the next stages of the installation process.

2. Create another database and call it ‘Mobile-Staging’.
3. Make sure that SQL Server Agent is switched on.

Installation:
Step1:
Run the mobile server installation msi file

Which should take you straight to the component selection section

Uncheck the systems that are not installed and click next
Step 2:
The next stage of the installation process is the Server Connector install. Server connector is the integration component in the mobile server that facilitates communication between the server and the backend ERP system.

Check the required server connector and click next

Step 3:
The next step is to create the Document Service Virtual Directory

Document Service is simply a web service used to send document to the backend ERP system, (Dynamics AX).
Note: for demo purposes, it’s recommended that the default names are not changed, in addition one can uncheck the security features (encryption of the web.config file and enabling ssl on the web service).

Step 4:

A proxy user needs to be setup if the ERP system is installed on a different server.
Import the active dynamics ax client configuration file.
Step 5:
Deployment Service Settings

Deployment services are used to install/deploy updates or installation files on to a mobile device.
As I mentioned above, deployment services use a SQL database, and hence a db connection string needs to be specified:
Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=;Data Source=
Step 6:
Logging Services

Logging Services enable administrators to manage logs sent from a mobile device. As I mentioned above, logging services require a SQL database and hence a connection string needs to be specified.
Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=;Data Source=
Click next and close the Server installation program.
Step 7:
Run scripts to create Deployment and logging Database objects.
By default these scripts are located in the following directory:
//server//Program Files/ Microsoft Dynamics Mobile / Mobile Server /SQL Scripts.
The folder contain 2 script files. One script is to create the deployment database objects and the other one is to create the logging database objects.
If you created just one database (MobileServer) for both(recommended for demos) then both the scripts need to be executed on the same database.

Step 8:
Install Dynamics Mobile Sales (using the msi file in the mobile sales folder).
This step needs to be preformed to create/setup the staging database.
Step 9: Staging Database:
The staging database is a sql server database that contains a section of data which is extracted from the ERP database. Data from the staging database is sent to the mobile device in the required (xml) format, this is done by synchronizing the sql server compact database installed on the mobile device (along with the dynamics mobile client), using merge replication [3] against the staging database
The first step is to locate the sql scripts that were extracted in step 8. The default location of the scripts is:
C:\Program Files\Microsoft Dynamics Mobile\Mobile Sales\Server\SQL Scripts
The following are the 3 scripts that need to be executed in the given order:
• 1 Create Mobile-Staging - Database.sql
• 2 Create Mobile-Staging - Database objects.sql
• 3 Create pubMobile-Staging - Replication.sql
Note: if you already create the Staging Database (Mobile-Staging) then you do not need to execute the 1st script
// TODO: mention about a possible errors and resolution.
Step 9:
Granting Mobile Sales users (mobile sales group) access to the staging database:
Execute the following script or manually add the mobile sales group to the Mobile Staging database using sql server management studio
USE [master]
GO
CREATE LOGIN [yourDomain\Mobile Sales Users] FROM WINDOWS WITH
DEFAULT_DATABASE=[master]
GO
Use [Mobile-Staging]
PRINT 'Adding user and roles to database'
GO
-- Add login to database
CREATE USER [Mobile Sales Users] FROM LOGIN [yourDomain\Mobile
Sales Users]
GO
EXEC sp_addrolemember N'db_datawriter', N'Mobile Sales
Users'
GOEXEC sp_addrolemember N'db_datareader', N'Mobile Sales
Users'
GO
GO
EXEC sp_grant_publication_access @publication =
N'pubMobile-Staging', @login = N'Mobile Sales Users'
GO

Step 10: Installing the SSIS Package
The SSIS package contains table mapping ( from the ERP DB to the staging db), hence there are different packages provided for the various supported ERP applications.
The default folder is C:\Program Files\Microsoft Dynamics Mobile\Mobile Sales\Server\product name.
Open the .dtsConfig in any xml editor (notepad) and change the Default Company account (to the company account setup in the ERP system). The default company account specified in the config file is DMO.
Save and close.
Double click on the ‘.dtsx’, which should bring up the Execute Package Utility window.
Now click on the ‘Connection Managers’ (on the left hand pane), and assign the correct databases to both AX DB and Staging DB connection managers (Note: check the check box next to the connection manager in order to edit the connection string).

Now click on ‘Configurations’

And add the .dtsconfig file you edited in the beginning of this step.
Now click on Execute
Hopefully there won’t be any errors....
Note: people mostly get error around created/modified date/time fields.. if this happens, then open of the .dtsx file in visual studios and edit the mappings. (this basically happens, because created/modified date/time fields are created on a table, when the relevant properties are set on the table. If you are using a customized version of ax, and for some reason have this property set to false on the table then you either need to change the table property in AX(the erp system) or change the ssis package mappings.
Step 11: importing the deployment and logging management snap-ins
“The Microsoft Management Console (MMC) provides system administrators and advanced users with a flexible interface through which they may configure and monitor the system and applications” [5]
Dynamics Mobile contains 2 snap ins that can be added to the management console:
1. Deployment Manager Snap in
2. Logging Manager Snap in
The deployment manager snap in enables administrators to install/ update applications on the mobile device, where as the logging manager snap in allows administrators to manage/view logs sent from the mobile device.
To open Windows Management console:
Click on Run > type in “MMC” > press ok

Now click on File and select “Add/Remove Snap in”
Then click on the add button, which would open up a list of Add Standalone Snap-In. Browse down to the Mobile Server Deployment Manager snap in (which was installed when the Mobile server installation process executed step1). Click on Add


Now select the server and the database that was created for mobile deployment operations

Click ok.
The following pic shows the deployment management snap in

Repeat the above process (step11) to add the Mobile Logging Snap in.
To be continued..
References:
1. http://www.inspirationalquotes4u.com/waltonquotes/index.html
2. http://www.microsoft.com/dynamics/ax/product/mobilesolutions.mspx
3. http://msdn.microsoft.com/en-us/library/aa179416(SQL.80).aspx
4. http://www.microsoft.com/sql/techinfo/whitepapers/mergerepmobileapp.mspx
5. Installation and Development in Microsoft Dynamics AX mobile 2008 - CHAPTER 2: MOBILE SERVER COMPONENTS
6. http://msdn.microsoft.com/en-us/library/bb986981(MAG.9).aspx
7. Microsoft Dynamics Mobile Integration - White Paper
8. Microsoft Dynamics Mobile Development Tools – White Paper