I recently had an interesting situation with one of our clients who wanted to use a custom entity modeled on the Accounts entity to view their customer data. The difference was that this entity would have a N:N Relationship with Contacts instead of a 1:N relationship; however they still wanted to be able to view a rollup of all the Activities and Opportunities from the related Contact and Opportunity records on the custom entity form (see the class diagram below).
So I did some research and found an
Step 1. Create Dynamics CRM 2011 Package project and connect to CRM.
Step 2. In CRM Explorer, right click on the custom entity and select Create plug-in.
Step 3. In the Create Plug-in dialog, select values as below. CRM SDK tool kit will automatically generate a CRM plugin project and the structural code. You just need to implement the PreActivityRetrieveMultiple function as described in the next step.
Step 4. Implement PreActivityRetrieveMultiple function as below. Some code has been omitted.
Step 5. Build and deploy the project. With CRM developer toolkit, you can deploy CRM plugin or custom workflow activity within Visual studio.
Step 6. Test the plugin. Verify the activity associated view in the custom entity. In the standard activities associated view of the custom entity, you should be able to see the activities from child contacts and child opportunities.
As some might already have noted by now, one of the downsides of working with the CRM SDK 5 is that it’s quite different from previous versions and some components in the previous versions are no longer supported or are changed, which can often frustrate the developer. However, I feel that it does streamline the development process of CRM plugins and custom workflow activities and can help to improve the development productivity. Developers can also make other CRM developments and customizations within Visual Studio.