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.
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.
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.
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