Debugging · Dynamics CRM 2011 · Plugin

CRM 2011: Plugin Playback (Offline Plugin Changes not synchronised)

I came across a very frustrating problem today regarding offline plugin playback where changes in offline plugin disappears when user goes online. I hope this will help others.

Scenario
1. Pre-Event Update plugin which runs both online and offline. When online if context.IsOfflinePlayback is true, return.
2. Plugin will auto-populate another field.
3. User update the record while offline.
4. Plugin triggered and auto-populate the field. This is confirmed by re-opening the record. Heck, I even used advanced find to confirm.
5. User goes online.
6. Auto-populated field is empty.

Investigation
Based on CRM 4.0 Offline and Online Synchronization White Paper, all ‘write’ requests are accompanied by a second update to a local data store that is used for the synchronisation process. This means that in offline mode, an additional database write is performed for each successful modification of the data in the local SQL Server Express database. These data is stored in local Offline Queue table which tracks Create, Update, and Delete operations.

I also find that on playback, the original request is passed to the ‘online’ version of the same plugin. This request does not contain the auto-populated field by the ‘offline’ plugin.

Conclusion
Pre-update plugin which auto-populates another field of the same record using pre-event update method (ie, setting the attribute of the entity in context directly) will be reflected in the offline database; however, since only the original update request is sent when synchronising, it is as if user updates the record as he/she did when offline (as if the offline plugin never takes place online).

In saying this, if the pre-update plugin modifies the data other than using pre-event update method (ie, using org service to create, update, or delete record), these changes will be reflected when synchronised to online.

Some relevant information on synchronisation process I found while googling:
CRM 2011 – Outlook Synchronisation Process – who wins
CRM 2011 Outlook Synchronization Process

Cheers – Sy

Advertisements

2 thoughts on “CRM 2011: Plugin Playback (Offline Plugin Changes not synchronised)

  1. “CRM 2011: Plugin Playback (Offline Plugin Changes not
    synchronised) | sliong” ended up being a great post.
    In case it possessed more images it would definitely be quite possibly much better.

    Take care -Willa

    1. Hi Willa,

      Thank you for your kind words and suggestion. I am always looking for ways to improve my blog post. Can you please be more specific what kind of images you meant?

      Regards,
      Sy

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