The Microsoft Dynamics CRM Blog
News and views from the Microsoft Dynamics CRM Team

Enabling Notes on Custom Entities after they have been created

Enabling Notes on Custom Entities after they have been created

  • Comments 15

Hello everyone,

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.

Disclaimer:

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:
ImportExportXml/Entities/Entity/FormXml/Forms/entity/form/tabs

·         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.

-       Enjoy

Our “Test” Custom Entity before the operation:

 

Our “Test” Custom Entity after the operation:

 

Aaron Elder
Director, Software Development
invokesystems

  • Wonderful tips. Thanks a lot. bookmarked! :)
  • Excelent post!!
    Very useful for us the desingners on business needs.
    Keep it up!
  • Great post.  Is there anyway to enable activities on a Custom Entity?  It looks as if the SQL script would need to be updated.

  • I want to know if there is a way to enable activities on a Custom Entity???

    thanks and gtreat post!!  

  • Activities are a little more involved, I do have a similar script that works with Activities but haven't tested it enough to release publicly.

  • Why in the world is the product team posting unsupported hacks?

  • Do you have the enable Activities scripts?

  • Is there any way to remove Notes and Activities from a Custom Entity?

  • Hello everyone, 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 calle

  • Hello everyone, 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 calle

  • PingBack from http://www.keyongtech.com/384172-how-to-modify-the-associated

  • Cannot find your Script. Can you send me a new link to the script?

  • This is genius to publish script on other web-site (site is currently off) instead of posting it here.

  • So does anybody have a working link to this script? Thanks

  • No one has mirrored this file huh?

Page 1 of 1 (15 items)
Leave a Comment
  • Please add 1 and 8 and type the answer here:
  • Post