Inspired by our rather radical approach to enforcing development discipline, Andre “I’ve got 88 in my handle” Margono decided to pick on another sinful habit in development, this time within plugin development.
Corporal punishment triggering behavior this time is to select all attributes as filtering attributes for Update message.
Unfortunately, plugin registration tool that comes with CRM SDK encourages this behavior by automatically pre-selecting all attributes for new steps.
With the CRM 2013 auto-save functionality, imagine how many redundant plugin executions triggered if the list is not filtered (every 30 seconds or when navigates away from the current form).
To filter that list in Visual Studio Development Toolkit:
or in the plugin registration tool:
With the list restricted to the attributes your plugin cares about, the code will only be executed when any of these attributes are changed.
An interesting quirk about the filtering attributes – if you have multiple CRM environments (ex. a dev environment and a production environment) where you push your solutions from one to the other, a plugin step that is filtered to “All attributes” will not send this detail in a solution. The step’s filtering attributes is a node in the solution XML, and if it is set to “All attributes” the node isn’t included. So if you are changing a plugin step from having a filter to All Attributes, you would need to manually update that anywhere you need the step changed, and cannot rely on the solution import to do it for you.