Dynamics CRM 2011 · Dynamics CRM 4.0 · Plugin

CRM 2011: Offline Plugin – Modifying Plugin to Support Offline Execution

This is a post following CRM 2011: Offline Plugin – Assembly Security Registry. In this post we are going to discuss about modifying plugin code to support offline execution.

The important thing to remember here is that the plugin that is running both online and offline may execute twice. Please note the use of the word may and not will.

Things to consider:
1. Obviously, plugin may run twice.
2. Does a plugin need to run offline or if it’s just a nice-to-have feature? Eg. business rules validation
3. Data might not be available offline which may be required by the plugin – Offline Filters. Eg. unique number generation
4. CRM 4.0: manually assign guid to new record.

MSCRM context has two properties to determine the status of plugin execution.
1. IsExecutingOffline property to determine whether the plugin is executing in offline mode.
2. IsOfflinePlayback property to determine whether the plugin is executing because of synchronization process (executing the second time)

For CRM 4.0, these properties are named differently.
1. IsExecutingInOfflineMode
2. CallerOrigin just use if (context.CallerOrigin is OfflineOrigin)

For more information for MSCRM 4.0, read the MSDN articles below:
Online vs. Offline Plug-ins
Creating a Plug-in for Microsoft Dynamics CRM for Outlook that Works Offline

Cheers – Sy

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s