CRM 2011 Plugin Template

Here is the template to get you started on plugin development in CRM 2011:

To get the service context of your organisation :

Important Notes:

  • You don't need to call SaveChanges because the entity can be updated before it is saved into database.
  • For pre-update, entity will only have attributes that are changed. To get the other attributes that don't change, you can query those attributes using the service context.

  • You need to call SaveChanges because the entity has been saved into database.
  • Entity will have all updated attributes when retrieved using service context.
  • When doing the post update of an entity that update the same entity attributes, loop will occur. To avoid this you can use context.Depth to check the loop count.

  • For delete message, the context.InputParameters["Target"] is an EntityReference instead of Entity.
  • You can check the context message using context.MessageName

Hope this helps,

Post a Comment