Saturday, January 05, 2008

Adding Notes or Activities to Existing Entities and Copying Entities

Sonoma Partners posted a great article about Enabling Mail Merge for Upgraded Custom Entities where they export an entity, look at the XML, modify one of the tags, and then reimport the XML. Until their post I had not seen this new XML tag so I was very excited to see this great find because I was actually pretty disappointed about what I could and couldn't use with Mail Merge.

My post today builds on this a little and I'll show you another use for looking at exported entity XML.

I once made a custom entity with literally 150+ fields under the assumption that no activities or notes would be needed on the custom entity. During a screen review I was told everything looked great but they wanted to attach things to the entity...and I then thought about recreating all 150+ fields, placing them on the form, and applying the scripts...again. I was not excited about doing that at all because as you may or may not know, once you create an entity and set it up with or without Notes and Activities, it's set, there's no checkbox to click to get that functionality added back after creation.

After a bit of searching and a random idea about reimporting my XML into an existing entity I found my answer. I exported the entity XML hoping to import it on top of an existing custom entity that had Notes and Activities enabled, I got an error however regarding type codes not matching or already existing. So, I went through the XML and as I was searching I found some tags (that you can see very apparently in one of the Sonoma screenshots of their post) called:

HasRelatedNotes
HasRelatedActivities

I then had a crazy idea. I deleted my old entity, published, changed the HasRelatedNotes tag to True (or 1), imported the "new" entity and I then had all 150+ fields, form setup and scripts as before only this time with attachment capabilities.

Now take this one step further and you could even copy an entity by modifying a few tags here and there so that the "copied" entity has a unique name, entitytypecode, and identifiers. I've done this a couple of times and I have to fight errors about things already existing but for the most part the errors were decent in letting me know what I has messed up...not necessarily where though. It's great for larger custom entities that need to be extremely similar. I don't come across this all that often, but it has come up and has saved me hours of time for my clients.

Maybe not the most user-friendly way of doing things but it is much faster and not nearly as tedious as reentering hundreds of fields and hoping you get all of the types, max vaules and defaults correct a second time.

Hope this helps someone else who could be in dire needs of a quick solution to a similar problem that I ran into.

David Fronk
Dynamic Methods Inc.

4 comments:

Udith said...

Changing the both HasRelatedNotes
HasRelatedActivities change to true is not enough
after you have done the change you should have to copy note xml code from the other entity
I have put below the copied code

<tab id="{0e6c69e0-3db6-457c-a010-b3dad403fbec}" IsUserDefined="0">
<labels>
<label description="Notes" languagecode="1033" />
</labels>
<sections>
<section showlabel="true" showbar="true" locklevel="0" id="{ca8875f2-6ffa-4218-af37-eea900600bbd}" IsUserDefined="0" height="auto">
<labels>
<label description="Notes" languagecode="1033" />
</labels>
<rows>
<row>
<cell colspan="2" showlabel="false" rowspan="5" auto="true">
<labels>
<label description="Note Text" languagecode="1033" />
</labels>
<control id="notescontrol" classid="{06375649-c143-495e-a496-c962e5b4488e}" />
</cell>
</row>
<row />
<row />
<row />
<row height="auto" />
</rows>
</section>
</sections>
</tab>"

then publish and see the entity will show the note tab

if not you have to delete the entity and have to import the customization

Udith Wiratunga

Dynamic Methods said...

Udith,

This is great, thanks for the additional clarification.

David Fronk
Dynamic Methods Inc.

Anonymous said...

I need to enable notes and activities for a system entity. I tried manipulating the xml but it won't work. How can I do this? Please help

Dynamic Methods said...

Unfortunately System Entities are locked down in such a way that you can't update them or add notes and activities if they weren't already there. Sorry, that's just how the system was built.

David Fronk
Dynamic Methods Inc.

Post a Comment