26 July 2011

Dynamics Mobility and HTML5

Dynamics Mobility is to enable workforces to have access to their Dynamics CRM/ERP data through mobile device anywhere, anytime. It should also enable an enterprise to leverage mobile communications to stay connected for people.



So what mobile platforms we are talking about?
Let's take a look at two latest reports from Gartner and ABI Research:




Also we must consider Nokia's strategic alliance with Microsoft on Windows Phone 7, and the retirement of Symbian. All facts taken together, the target mobile platforms are:

• Google Android
• Apple iOS
• Microsoft Windows Phone
• BlackBerry



So what is the solution?
In general, there are two approaches to get the proper mobile solutions for Dynamics:
1. ISV solutions
2. Custom solutions

ISV Solutions
If we are talking about the CRM Mobility solution, there are two major ISV providers on the market, TENdigits and CWR Mobility. Both ISVs provide advanced level mobility solution for Microsoft Dynamics CRM.

Also Microsoft Dynamics CRM 2011 has an out-of-box Mobile Express version which works on the target devices but lack functionalities,i.e. no offline mode.



Custom Solutions
To develop a custom solution on mobile device, let's take a look at the different types of mobile application first. There are two kinds of mobile application:
• Native app
• Web app

On the bright side of native app, it provides native APIs support for the mobile device, but you have to build applications using that mobile OS specific language. In other words, you need to develop different applications for different devices, in our target mobile platform, you need to develop 4 applications for Android, iOS, Windows Phone and BlackBerry. So you can probably imagine that it requires some efforts on upgrading and maintaining the application.

Another choice is the Web app which is browser based application that running on the mobile devices. Generally speaking, mobile app provides the Cross-Platform support, so one web app can suit different mobile platforms. The blind side for web app are mainly on: performance and limited API access.

So if we want to build a unified cross-platform mobile application, prepare for the future and develop for the future, the mobile app is a good choice. But before making the choice, we also need to make sure that we have a clear goal. i.e. to build a CRM mobile application to allow salesperson access CRM data via their iPhone and iPad with offline mode... And then find out whether the web app can do the work on various aspects (local storage, security, performance etc.)

HTML5 is the choice for web app
HTML 5 web app is the perfect choice for web based applications that are designed for mobile devices. HTML5 will be the new standard for HTML, XHTML and HTML DOM. Although HTML5 is not yet an official standard, and no browsers have full HTML5 support. All major browsers (Safari, Chrome, Firefox, Opera, and Internet Explorer) continue to add new HTML5 features to their latest versions, as well as the mobile browsers.

Now, are we going to build HTML5 web app start from scratch - No, we don't have to. There are some framework you can choose to use right now:

jQuery Mobile is the most broadly compatible HTML5 library for building web sites and apps. JQuery mobile framework takes the "write less, do more" mantra to the next level: Instead of writing unique apps for each mobile device or OS, the jQuery mobile framework will allow you to design a single highly branded and customized web application that will work on all popular smartphone and tablet platforms.

PhoneGap is an HTML5 app platform that allows you to author native applications with web technologies and get access to APIs and app stores. PhoneGap leverages web technologies developers already know best... HTML and JavaScript.

The following diagram shows how PhoneGap works:


Both jQuery Mobile and PhoneGap are under the MIT license.

There are also commercial frameworks that available on the market, i.e. Sencha.
Sencha Touch is the world's first app framework built specifically to leverage HTML5, CSS3, and Javascript for the highest level of power, flexibility, and optimization. It allows you to develop mobile web apps that look and feel native on iPhone, Android, and BlackBerry touch devices.


So, are you ready for the HTML5 front-end web app of Microsoft Dynamics? :-)


Jim Wang
Microsoft MVP Dynamics CRM
July 2011

16 July 2011

CRM 2011 Plugin Development Workspace

2 years ago, I wrote an article about Build a handy Dynamics CRM development environment, which has been widely used in the community. I have also provided several CRM 4.0 and 2011 development training courses for .Net developers in the past few years, the result and feedback were very good.

Now the Microsoft Dynamics CRM 2011 has been released, I'd like to guide you through an efficient development workspace for CRM 2011. The overall develop/build/debug process should be very smooth, see the following diagram:


First of all, the CRM 2011 only support 64bits server, so if you are using Windows 7, I suggest you to use the Oracle VM VirtualBox to install CRM 2011 server. My experience is the VirtualBox does everything you need for the development purpose, quicker and smaller, and also it supports 64bits Guest OS (even with a 32bits Host OS).

The minimum RAM required to run CRM 2011 (all-in-one box) is 3GB (recommend 4GB); It's also possible to install the SharePoint foundation 2010 on the same box if you have SharePoint document integration.

About the Host PC, the minimum RAM required is 4GB, it's good to have 8GB RAM (all with 64bits Windows 7); install Visual Studio 2010 on the Host PC for better performance, then you can set up the Visual Studio 2010 Remote Debugger (x64) on the Guest OS that has CRM 2011 server installed (refer this article about how to Build a handy Dynamics CRM development environment).

Next, after you developed a CRM plugin in Visual Studio 2010, you may register it using the Plugin Registration Tool (can be found in the CRM 2011 SDK). Make sure you register the DLL in the Disk (during development/testing phase); Also change the project properties in Visual Studio 2010: change the Build | Output path to the CRM server assembly folder, i.e.:
\\CRM\c$\Program Files\Microsoft Dynamics CRM\Server\bin\assembly\

So each time you build the project, the new DLL and PDB file will be output to the assembly folder, CRM will pickup the new plugin DLL automatically without manually re-registering it.

If you get the error message when rebuild the project in Visual Studio: "Unable to copy file ... because it is being used by another process...", you may add the "Pre-build event command line" to recycle the CRMAppPool or restart the Service of the CRM server (See: Build a handy Dynamics CRM development environment).

If you use PowerShell to do so, you need to change the Host PC's Execution Policy to Unrestricted and RemoteSigned.

On a 64bits Host PC, use the below command to start PowerShell,
%SystemRoot%\sysWOW64\WindowsPowerShell\v1.0\powershell.exe

Then execute the following command:
Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy RemoteSigned

(Note, the 32bits PowerShell command line is in another folder:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe )

To debug a plugin, make sure you attach the right process:

  • online - w3wp.exe
  • offline - Microsoft.Crm.Application.Hoster.exe
  • asynchronous registered plug-ins (or custom workflow assemblies) - CrmAsyncService.exe
  • sandbox (isolation mode) - Microsoft.Crm.Sandbox.WorkerProcess.exe

Hope it helps!
:)