You are looking for plugins: http://msdn.microsoft.com/en-us/library/dd393295.aspx .
You can register a plugin to create, update, delete, etc. object, and then run whatever custom code you want. You will definitely have access to the object name and identifier, as well as to the fields that have been updated, information about the user who initiated the call, etc.
Just know that in MSCRM 3.0 and 4.0 plugins work outside the real database transaction, so it is possible that the event can fire in CRM, but the plugin does not work and the event still passes. In MSCRM 2011, they are triggered within a transaction and can stop the CRM event, if necessary.
source share