Thursday, January 10, 2013

CRM Offline capabilities




One of the main selling points of MS CRM is its offline capabilities. The way it seamlessly goes
Offline and online is simply awesome. This is actual innovation. One of the major reasons of going offline is to cater to sales to process and increase CRM adoption in emerging economies where internet presence is limited and inconsistent.
Though its integration with outlook is a bit shady but simple UX of outlook overshadows this.
This blog post is to outline some of the things to remember while developing for CRM outlook.
If your organization is going for Offline capabilities in MSCRM then while developing feature for your organization you should always have "offline" at the back of your mind". What are the things to keep in mind to take your feature "offline" or to make your feature work while in offline mode ?

The various components to take care of while developing a feature for offline as below:
  1. Plug-in and assemblies
  2. Webresources (Silverlight, Xml, JS, CSS, HTML)
  3. Outlook offline filters
  4. Web services and web pages
  5. Outlook
  6. Security
  7. System Configuration
1. Plug-ins and Assemblies
One of the most important features in extending MSCRM is plug-ins. Thanks to the pipelined architecture, you can inject your own logic into the core process by implementing plug-ins over various messages. Sure workflows are good but they are limited.
The thing to keep in mind during developing a plug-in is to decide whether to execute particular plug-in logic in offline mode as well. There are certain properties which you need to check in the plug-in context to implement this. The important thing to keep in mind is once the plug-in has run in offline, it should be avoided in online mode while synchronization. For your plug-in to execute in offline mode you also need to make an entry in registry

Go to HKEY_CURRENT_USER\Software\Microsoft\MSCRMClient
Under the "AllowList" add the new key with name as the public key token of the plug-in assembly.
If your plug-in references other assemblies or implements early binding using server interfaces generated by crmsvcutil.exe then you need to make sure the current core assembly versions are registered in the client GAC too. Microsoft does not provide the old versions of MSCRM core assemblies. You have to main the different release versions of sdk assemblies on your own. If the core client assemblies are not present in your machine while the plug-in is running code built against the versioned CRM assembly then your plug-in will fail to execute. Therefore I recommend using late binding in plug-ins and custom workflows always. If you are referencing assemblies then distribute a package using the Microsoft Software Distribution channel framework ("Run Advertised Programs").

2. Webresources
The main reason why Microsoft introduced webresources is to bundle and make available logic and resources, used in a feature, in client for offline capabilities. If the entire logic in written in webresources then they will be downloaded to clients' native databases while going offline. So if you are thinking of taking a feature "offline" then implement it as far as possible in webresources. The webresources behave as standalone units of logic which can reside in client machine.

3. Outlook offline filters
Say you have a lookup in Account to select the country. If you are in offline mode and trying to set this lookup and you find there is no country data available to select from. But in online mode it is there. While going offline the outlook plug-in synchronizes the local native database with data from server. Now what data need to be brought offline is decided by outlook filters. This is very important for master data management.

One other thing to keep in mind is that the master data may be huge. In this case only the user relevant data may be brought offline. So you have to design the filters keeping the amount of relevant data in mind. In other words you can say the client machine becomes a mini server available at your disposal.

4. Webservices and webpages
If your feature accesses any external web services or web pages then it might be impossible to make the feature available offline difficult unless internet connection is available when feature is accessed offline. Make sure you have no client endpoints and referred external resources except webresources in your feature.

5. Outlook
I need not elaborate on this because this is very basic. You need to take care of offline settings in your outlook (File->CRM). If you feel your outlook plug-in is running slow then you can try clearing the cache in the "Diagnostic" wizard. You can also enable tracing but be aware that it generates huge amount of logs. There are also many more hidden settings such as you can add a registry entry DWORD "DisableSolutionsModule" in HKEY_CURRENT_USER\Software\Microsoft\MSCRMClient to hide the Organization icon appearing as a tab (like "Mail" or "calendar")(benefits of working closely with Microsoft :P).

6. Security
Your security must be designed in a way so that MSCRM takes care of the data visibility. It reduces a lot of effort on coding front. It also reduces data burden on native SQL database. You also need to make sure the users are given privilege of going offline in their assigned security role.

7. System Configuration
Design the system with as much configuration as possible in CRM entities and all configurations available to users. This reduces maintenance cost. Also these can be downloaded to offline mode as well. Also there are system settings in server to control the outlook interaction with Server.

I agree that the outlook MS CRM plug-in is not up to mark in terms of performance and it is because it tries to replicate server behaviour in client machine.For e.g. it has its own component for serving CRM pages just like webdev.exe in Visual Studio. It has a native SQL database and many other things to make the "offline" possible.

I hope Microsoft come up with an offline client or better performing plug-in.




No comments: