Monday 17 June 2013

Interesting behaviour of MS Dynamics CRM 2011 when updating fields.

I found out something interesting, although, really annoying is more accurate today about updating fields in MS Dynamics CRM 2011 today.

Updating an entity field via custom code (either plugin, custom workflow activity or a simple app) or through a workflow activity, Update Record, will always trigger an Update event, even if the field is not actually being changed, i.e. it's being updated with the same value.

This might sound obvious, but it wasn't to me and some of my colleagues and it has repercussions for workflows that trigger on record field changes as they will be triggered when the value is set, regardless of whether it was an actual update or not.

This is slightly disappointing as this can lead to workflows being triggered despite the fact that for all intents and purposes, the field has not actually been changed and yet the workflow will be triggering, which could lead to users raising issues because things are happening in the system that shouldn't be happening.

The obvious answer is not to do the update if the value is not changing, which is what we are doing in a few places were this is an issue, but it seems to me that the platform, i.e. MS Dynamics CRM 2011, should be handling this. Particularly given that it's possible to prevent users from seeing the audit information, if auditing is indeed on at all, which for many things, it could well not be on.

Oh Well. 

No comments:

Post a Comment