This is my first blog posting on this site, but many of you have probably been following my other blogs: Invoke Systems (Current), MSN, and MSDN). The short version of the story is that I was a lead application developer on a .COM called “iCommunicate” that was a hosted Service Management web-based application with a pretty fancy UI. Microsoft purchased this company and I became a lead application developer on the Microsoft CRM v1.x and v3.0 team. I was responsible for application framework as well as many features of the v1.x product. Later, for Microsoft CRM v3.x my team and I “owned” the Application Framework. About 18 months ago, Jason Hunt and I left Microsoft to re-join Invoke Systems, the parent company that originally sold off iCommunicate. Our goal was clear: become the #1 Microsoft CRM development shop in the world. I am now the Director of Software Development at Invoke Systems and a Microsoft Dynamics CRM MVP and I am very pleased to have been invited to post here.
Ok, so enough about me, on with the post. The new customizations features in Microsoft CRM 3.0 are fantastic, with the ability to add Custom Entities Microsoft CRM became exceptionally flexible. With all this flexibility, we have been able to support many different business scenarios. These scenarios often require the system to be extended via Custom Entities and sometimes many Custom Entities (we have designed systems with over 30). As part of our design process, we decide up front if an entity will support Notes and/or Activities. We make this decision based on business needs. As an optimization, our default stance is to turn it all off and enable them for entities that warrant it. We do this because out-of-the-box when you enable Notes the system will add the “Notes Control” to the form and, when you enable Activities, the system will add an “Activities” and “History” left navigation item to the form. There is no “supported” way to remove these, so we only turn it on if needed.
One very annoying thing in Microsoft CRM 3.0 is the decision to enable Notes and/or Activities on your Custom Entity must be made up front at design time of the Entity. After the entity is defined, the UI no longer lets you change this.
This means that if your needs out-grow your original design or you simply made a mistake, you have to go through a pretty costly “upgrade” process, to re-enable Notes. The process would look like this:
- Export any data that is stored on the custom entity (if this is production)
- Delete the old custom entity
- Re-create the custom entity and enable Notes
- Import any data that was stored on the custom entity (if this was in production)
This of course was no small task, depending on the complexity of the entity and the environment, this process could take days or more to complete.
“A-ha” you say, you can just make the change on another system, export the customizations and import them back in! Or better yet, you can simply “hack” the export XML so that it looks like had originally enabled these relationships. Unfortunately, it's not that easy. The system does not support adding these relationships after an entity has been created; this includes the import aspect of the system. L
The answer? An “unsupported” hack of course! Basically, we just do what CRM would have done if that little checkbox were enabled! The basic process is:
- Update the Entity Information in the Metabase
- Add the relationships to the Metabase
- Regenerate the cascade SQL functions
Since this is an “unsupported” hack to the Microsoft CRM Metabase, it could cause problems in the future (although I personally believe the risk of this is low given the fact that this script emulates exactly what CRM does on the initial entity create J) . You may want to run this on a test environment first to make sure you are happy with it.
THIS PROCEEDURE AND RELATED SCRIPTS AND/OR TOOLS ARE PROVIDED "AS IS"
WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
THIS PROCEEDURE AND RELATED SCRIPTS AND/OR TOOLS HAVE BEEN DESIGNED
AND TESTED AGAINST USER OWNED CUSTOM ENTITIES. IT WILL NOT WORK
CORRECTLY AGAINST ORAGANIZATION OWNED CUSTOM ENTITIES.
The steps to enable notes are:
- Download the SQL Script and Cascade Function Re-Generator:
- Backup your CRM database and metabase
- Backup your CRM customizations by doing a full export
- Run the attached SQL script against your CRM Metabase Database
· Load the script into Query Analyzer
· Set the “entityname” variable ('[ADD ENTITY NAME HERE]') with the schema name of the entity to add notes to. Ex: “new_test”
· Execute the script
- Export just the entity that you want to add the Notes control to
- Edit the XML and add the “Notes” tab using the attached XML (I would use Visual Studio not Notepad)
· Add it here:
· Note you may need to change the ID GUIDs of the Tab and Section so that they are unique in your schema. Do NOT change the “classid” GUID
- Re-import the edited XML
- Publish customizations
- Run the CascadeGen.exe
· This EXE simply tells CRM to regenerate the cascade functions in the MSCRM database. If you don’t want to run this tool you can alternatively create another entity called “Foo” or something and then delete it. The end result is the same.
· To run this tool you will need to update the CascadeGen.exe.config file to work against your installation. If you run it from the SQL Server “.” will work for the data source. The tool requires that you be logged in as an administrator of the SQL server.
Our “Test” Custom Entity before the operation:
Our “Test” Custom Entity after the operation:
Director, Software Development