-
Using the OnSave event in MSCRM 3.0
Today, in a post in the MSCRM 3.0 Developer newsgroup, Simon pointed out that their was no reference to capture the Save and New button event.
The SDK documentation for the OnSave event lists the following event.Mode values:
CRM_FORM_SAVE_MODE_SAVE = 1
CRM_FORM_SAVE_MODE_SAVEANDCLOSE = 2I put the following code into the OnSave event of a form:
alert(event.Mode);
and found that Save and New generates a Mode of 59.
Write that down somewhere in case you need to capture that event.
Customization, Dynamics CRM 1,286 views -
The Great North-Texas Blizzard of February '06
Ok, it wasn't a blizzard. All that happened was it rained then dropped to 25 degrees, which made everything freeze solid with a quarter inch of ice everywhere.
Texans don't do ice very well and unfortunately, if you made the mistake of venturing into any of the Dallas-area grocery stores, you would have though it was the beginning of a month-long freeze, the way people where buying non-perishable goods and provisions.
And me, what was I doing at the grocery store? Buying brown sugar and ice cream to make hot buttered rum.
You wait out the end of the world in your way, and I'll do mine. :)
Meanderings 1,143 views -
Me and My Blog
Phillip Richardson had a great post today about blogging entitled: My 13 Tips to Expanding my Ego with Blogging.
It's a great post and I've already taken a few of his tips to heart and made some changes to my blog.Unfortunately, I discovered something that is a little embarrasing. If you search Technorati for Microsoft CRM, you will see three separate listings for my blog. This would be because I moved my blog twice and the current, now stable iteration, is the final. The other two, which are named the same, do not exist but are still listed for some reason.
Or maybe, I'm just trying to out-Ego Phillip. :)
I have an article in the works regarding how my blog came to be and the choices that I made during the process. I hope to have it posted later in the week.
Misc 1,218 views -
Recycling Gone Wrong
So I'm trying to be a good corporate citizen of the planet and have joined the recycle movement here in Coppell, Texas.
A couple weeks ago, I finally emptied out one of those industrial-sized bottles of Dawn dishwashing soap and I decided that I had to clean out the soap remnants before I could chunk it into my recycle bin.
Well, I am assuming you realize that when you attempt to wash away soap, what it does is to create lots and lots of bubbles. Mostly because, uh, that is its job.
I was attempting to debubble the bottle when I got tired of the rinse-repeat cycle. I figure there is a break even point between saving the planet from yet another plastic bottle thrown in the landfill vs. wasting 10 gallons of fresh water that another human could be using.
Anyway, I hit upon what I thought was a brilliant idea. I would just hold the mouth of the bottle tightly to the faucet and not let any of the bubbles escape. It would fill up with water and I could get back to more important things – like a nap or something.
This is probably the point where I need to mention that I never took any physics courses.
I think the average municiple water system has something like 17 pounds per square inch ( PSI ) of pressure. Do you know what happened when the contents of that Dawn bottle hit 17.1 PSI?
It blowed up.
Well actually, it was more like a volcano, so I guess the technical term is: erupted.
Very much so. Like, all over my kitchen so. Minus the part that was obsorbed by my face, of course.
So as I am standing in the middle of what can only be described as "a mess," the only thing I could think of was the fact that I really needed to clean the kitchen anyway.
Dumbass.
Meanderings 1,126 views -
My pants were on fire and my ass was catchin
A funny thing happened to me last week. What started out as a typical lunch with friends took a completely and unforeseen turn to the unbelievable.
It all started as I headed to lunch with three friends at one of our favorite eateries.
Not quite half way there, I noticed a rather warm sensation developing on my thighs and buttocks. I found this to be quite surprising. While I must admit my thighs and buttocks have been known to become inflamed, it does not usually occur when I’m in an automobile with an outside temperature of forty degrees or so.
“What, oh what, could be the problem,” I thought. Actually I was just a little bit more vocal than that – yelling out something to the effect of “What the hell’s going on!” It turns out that I’m rather sensitive about my thighs and buttocks being abnormally warmed. Oh well; live and learn. Life is but an adventure.
Anyway, there were at least three separate conversations occurring at this moment. All of which stopped when I became rather animated.
My very first thought was that my so-called friend, the owner of the vehicle, was attempting to kill me – albeit slowly and unusually. All I could determine was that he had wired the battery to my seat in a vain attempt at electrocution.
Either that or he had developed a “Fiendish Thingy” which relyed on Microwaves that were slowly but surely altering the chromostones of my yet unhatched offspring.
Either way, I was quickly becoming excitable.
About the time I was readying myself for a progeny-saving plunge out the truck door, it occurred to me that this was a fairly new vehicle and had all sorts of wonderful gadgets, features, and doo-dahs.
Still in my excited state, with my voice raised to the limit of hearing for dogs, Moms, and very small children, I shouted “Does this truck have a passenger-side seat-warmer?” “Why, yes it does.” Came the answer. “Is it on?” I queried. “I don’t know. Probably.” Was the response. “Well how the hell do I turn it off?” The instructions were provided, followed to the letter, and at long last the ambient temperature of my buttocks returned to normal. Whew!
Lunch continued on as usual and though I have a fairly decent explanation of the event, I have yet to rule out an assassination attempt. You just never can tell who your friends are these days.
Copyright © 2000 by Mitch Milam
Tall Tales 1,545 views -
Some people have too much time on their hands
I was just watching a show on the Science Channel where they showed the guys who ride bicycles downhill on a snow-covered mountain.
One guy had just achieved his personal best of ONE HUNDRED AND SEVEN FREAKING MILES AN HOUR. On a bicycle. In the snow. And did I mention down the side of a mountain? In the snow?
Do you know how you stop yourself on the snow should you happen to fall off the damn bike at 107 MPH?
YOU DON'T.
You keep moving until inertia and drag cancel each other out or you hit the side of a '73 Chevy pickup that's been left at the edge of the field because somebody put freaking SNOW on top of it and you don't know it's there.
Or you hit a tree. From personal experience, I can tell you that trees are nature's solution to inertial dampening.
Also notice I said guys, and not people. I didn't see any women doing this so-called sport. Girls are probably way too smart of such foolishness.
Meanderings 1,212 views -
Understanding Entity Ownership in MSCRM 3.0
When you create a new Entity within MSCRM you have a choice to make regarding the ownership of that Entity.
From the MSCRM 3.0 Help File:
In the Ownership list, select either:
- User
Records for this entity can be owned by individual users. For example contact records are set to User.– OR – - Organization
Records for this entity are used for reference by all Microsoft CRM users, and so are not owned by individual users. For example, product records are set to Organization.
While attending an MSCRM Troubleshooting class last week, I learned something that isn't readily apparant when you are creating enties:
In order for a custom entity to be available to the CRM Workflow module, it must be created with an ownership of User.
This was news to me, and unfortunately, unwelcome news. I had just created 12 custom Entities that had a combined total of over 100 Attributes and Relationships out the wazzoo. Since you can't change the Ownership type after creation, I was looking at spending a few hours deleting my existing Entities and recreating them from scratch.
And after thinking about it, I understand why the ownership requirement for workflow exists, I just wish it had been better documented.
Anyway, I was thinking ( mustly hoping ) that there just had to be a way to alter the definition of the Entity without having to manually recreate it. It turns out, there is, but it is a bit of work.
The following information is provided as-is, without any warranty, either expressed or implied.
It is probably unsupported by Microsoft as well.
Use this information for reference and as a last-resort.
How Entities are Organized
With the exception of three Attributes, the tables of a User Owned Entity and an Organizational Owned Entity are exactly alike. The following table contains the Attributes created when you create both types of Entities. Those in bold are specific to that Ownership type.
Organization Ownership User Ownership Name Type Name Type createdby lookup createdby lookup createdon datetime createdon datetime createdon datetime createdon datetime modifiedby lookup modifiedby lookup modifiedon datetime modifiedon datetime new_2blankoid primarykey new_2blankoid primarykey new_name nvarchar new_name nvarchar statecode state statecode state statuscode status statuscode status organizationid lookup ownerid owner owningbusinessunit lookup So, how do we convert an Entity from one ownership type to another as cleanly as possible and keeping the destruction to a minimum? I've successfully performed the following steps and have seen no side effects.
Step 1: Back up your CRM databases.
Step 2: Export All Customizations.
Even though you may only be working with one or two Entities, I feel it is best that all Entities be included in the export to ensure that we don't miss anything.
Step 3: Make a backup copy of your exported customizations.
Just in case your edits do not work as planned.
Step 4: Delete the custom entity that needs to be reassigned Ownership.
Sorry, there is just no way around this step. The Import Customizations process only adds data and changes, it will not delete anything, and we must delete attributes. That means data loss.
Step 5: Open the exported customizations in WordPad.
Or whatever your favorite XML editor is. Just remember how picky CRM 3.0 is about its XML format. Personally, I use WordPad because it doesn't introduce additional line feed characters that so offend CRM.
Note: Steps 6 – 8 will be repeated for each Entity that needs to be altered.
Note 2: DO NOT attempt to copy the following XML from this blog and insert it into your CRM Export file. It will break the file and you will be unable to import it. I would suggest Exporting a single Entity with User Ownership and have that open in a separate WordPad instance to copy the code from.
Step 6: Change the ownership type.
Find the following code:
<OwnershipTypeMask>OrgOwned</OwnershipTypeMask>
And replace it with the following:<OwnershipTypeMask>UserOwned</OwnershipTypeMask>
Step 7: Remove the Organization Attributes and Insert the User Attributes
DELETE THE FOLLOWING CODE
<attribute PhysicalName="OrganizationId">
<Type>lookup</Type>
<ValidForReadApi>1</ValidForReadApi>
<ReferencedEntityObjectTypeCode>1019
</ReferencedEntityObjectTypeCode>
<Description>Unique identifier for the organization</Description>
</attribute>
INSERT THE FOLLOWING CODE<attribute PhysicalName="OwnerId">
<Type>owner</Type>
<IsNullable>0</IsNullable>
<ValidForCreateApi>1</ValidForCreateApi>
<ValidForUpdateApi>1</ValidForUpdateApi>
<ValidForReadApi>1</ValidForReadApi>
<IsLogical>1</IsLogical>
<DisplayMask>ValidForAdvancedFind|ValidForForm|ValidForGrid
</DisplayMask>
<Description>Owner Id</Description>
</attribute>
<attribute PhysicalName="OwnerIdDsc">
<Type>int</Type>
<IsNullable>0</IsNullable>
<ValidForReadApi>1</ValidForReadApi>
<IsLogical>1</IsLogical>
<AttributeOf>OwnerId</AttributeOf>
<XmlAbbreviation>dsc</XmlAbbreviation>
<Description />
</attribute>
<attribute PhysicalName="OwnerIdName">
<Type>nvarchar</Type>
<Length>320</Length>
<IsNullable>0</IsNullable>
<ValidForReadApi>1</ValidForReadApi>
<IsLogical>1</IsLogical>
<AttributeOf>OwnerId</AttributeOf>
<XmlAbbreviation>name</XmlAbbreviation>
<IsSortAttribute>1</IsSortAttribute>
<Description>Name of the owner</Description>
</attribute>
<attribute PhysicalName="OwnerIdType">
<Type>int</Type>
<ValidForCreateApi>1</ValidForCreateApi>
<ValidForReadApi>1</ValidForReadApi>
<IsLogical>1</IsLogical>
<DisplayMask>ObjectTypeCode</DisplayMask>
<AttributeOf>OwnerId</AttributeOf>
<XmlAbbreviation>type</XmlAbbreviation>
<Description>Owner Id Type</Description>
</attribute>
<attribute PhysicalName="OwningBusinessUnit">
<Type>lookup</Type>
<ValidForReadApi>1</ValidForReadApi>
<ReferencedEntityObjectTypeCode>10
</ReferencedEntityObjectTypeCode>
<Description>Unique identifier for the business unit that owns the record</Description>
</attribute>
<attribute PhysicalName="OwningUser">
<Type>lookup</Type>
<ValidForCreateApi>1</ValidForCreateApi>
<ValidForUpdateApi>1</ValidForUpdateApi>
<ValidForReadApi>1</ValidForReadApi>
<ReferencedEntityObjectTypeCode>8
</ReferencedEntityObjectTypeCode>
<AggregateOf>OwnerId</AggregateOf>
<Description>Unique identifier for the user that owns the record.</Description>
</attribute>
Step 8: Change the form fields from Organization to User.
DELETE THE FOLLOWING
<field name="organizationid" requiredlevel="na">
<displaynames>
<displayname description="Organization Id" languagecode="1033" />
</displaynames>
</field>
INSERT THE FOLLOWING<field name="ownerid" requiredlevel="na">
<displaynames>
<displayname description="Owner" languagecode="1033" />
</displaynames>
</field>
<field name="owningbusinessunit" requiredlevel="na">
<displaynames>
<displayname description="Owning Business Unit" languagecode="1033" />
</displaynames>
</field>Step 9: Save and close the Export file
Step 10: Import the modified Exported customizations
Step 11: Publish All Customizations
Do this before you do anything else with the system as it will ensure that all of the data is completely replication throughout the CRM 3.0 system.
Finished.
Just to make sure everything is fine within the CRM 3.0 system, I perform the additional steps:
Step 12: Add a temporary Attribute to the altered Entity.
This is really just to make sure that the CRM Entity modification process still functions as expected.
Step 13: Add that Attribute to the data entry Form.
Step 14: Publish the Entity
Step 15: Create and save a new record for the altered Entity.
Step 16: Delete the temporary Attribute from the Entity.
Step 17: Publish the Entity.
Really Finished.
Good luck and if you find any issues, please let me know.
Customization, Dynamics CRM, Unsupported 3,939 views - User
-
MSCRM 3.0 Entity Deletion Caveats
Deleting Entities from within MSCRM 3.0 is fairly staightforward but you need to keep the following things in mind:
- You can't delete system Entities.
- You can't delete an Entity if it is being referenced on a Form of another Entity. An error message will be displayed alerting you to the references to that Entity.
To accomplish this, you must perform the following steps:
- Edit the form that contains the reference to the Entity that you wish to delete. ( This is usually a Lookup field produced by adding a Relationship between two Entities. )
- Remove the Lookup field and save the Form.
- Save the Entity.
- Publish the Entity.
- Select the Entity you wish to Delete and click the Delete button.
- Repeat steps 1-5 until you actually delete the Entity.
- As a safety measure, select More Actions, then Publish All Customizations, so that you can be sure that the entire CRM system has been notified of any changes you have made.
Customization, Dynamics CRM 1,203 views -
MSCRM 3.0 Exporting and Importing Customization Notes
MSCRM 3.0 allows you to Export customizations from one system and Import those same customizations into another system. This is handy should you have separate development and test environments and need to move configurations between the two.
You can also Export customizations such as the Site Map and ISV.Config file, perform required modifications, and Import the altered files back into the same system.
However, there are a few caveats to keep in mind when performing these processes:
- Imported customizations are not automatically published, so you mush manually publish the changes.
- If you are making sweeping changes to the system, i.e., making many entity modificiations, it is sometimes necessary to Publish those changes immediately after the Import, in order for the system to become fully aware of them.
I have seen instances where I was unable to edit an Entity after Import. I first had to Publish that Entity, then edit it.
- If you export a large number of Entities ( or All of them ), the Import may fail with a SQL error if you choose to Import All Customizations. The work around it to just select all of the Entities then select More Actions, Import Selected Customizations.
- Relationships between Entities are not maintained unless you export all of the related Entities together.For example, let's say you have a custom Entity called Jobs that is related to an Entity called Time. If you Export Jobs from one CRM system, and Import it into another CRM system, the Relationship with the Time Entity will be lost, because the information was not Exported from the original CRM system. Even if you later Exported and Imported the Time Entity, the Relationship would still not exist.Exporting both Jobs and Time Entities will ensure that the relationships will be maintained during the process.
- There are two Entities that, if improperly altered, can cause the MSCRM system to fail to load and/or function properly: Site Map and ISV.Config. If you have made massive changes to the CRM system and are Importing the entire system, you wish way to perform a two-stage Import and Import those two Entities in the second stage.
- If you import customizations including an ISV.Config file that contains errors, the import will succeed, but Microsoft CRM will not start, and the following error will be displayed “SiteMap error.”Workaround: In your browser, open
http://[microsoft_crm_servername]/tools/systemcustomization/
ImportCustomizations/importCustomizations.aspx
and import a corrected ISV.Config file. - If you are moving your configuration from a Development CRM system to an existing Production CRM system and have changed the Type of an Attribute ( say from a nvarchar to an int ), you will need to delete the Attribute from the Entity on the Production CRM system before you attempt the Import. Otherwise, the Import will more than likely fail because the Import will not alter the Attribute Type and SQL Server will generate an error when it finds an nvarchar when it expects an int.
Note: I am going to assume that I don't need to tell you that you'll loose data when you delete the Attribute – so plan ahead for that.
Customization, Dynamics CRM 3,060 views -
Researching MSCRM 3.0 Internals
In the Microsoft Business Solutions CRM Developer Newsgroup, Arne Janning gave an excellent suggestion for those of you with developer inclinations and a willingness to explore the MSCRM system to learn more about its inner-workings.
Open Notepad and create a file that looks like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<ItemGroup>
<Item Include="*/**" />
</ItemGroup>
</Project>
Note: If you copy and paste the above text into notepad or VS2005, make sure the double-quotes are normal double-quotes and not the special "pretty" quotes. VS doesn't like the fancy quotes and will give you errors when you attempt to open the file.
Save this with a .csproj extension in the root-folder of your MSCRM web site. Load Visual Studio 2005, select Open Project, navigate to the MSCRM web site then double-click on the .csproj file.Just don't do anything unwise like saving any of the files. We don't want to run the risk of upsetting CRM in any way – or damaging the files and rendering the site unusable.
I also hope I don't need to state that it is a really bad idea to do this to a production server, do I?
References:
Customization, Dynamics CRM, Unsupported 1,527 views





(2 votes, average: 4.50 out of 5)