<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mitch Milam&#039;s Dynamics CRM and xRM Discussions &#187; Unsupported</title>
	<atom:link href="http://blogs.infinite-x.net/category/dynamics-crm/unsupported/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.infinite-x.net</link>
	<description>Sharing information with Dynamics CRM users and xRM developers</description>
	<lastBuildDate>Wed, 08 Feb 2012 16:27:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Changing Column Width of a Section using JavaScript</title>
		<link>http://blogs.infinite-x.net/2010/07/22/changing-column-width-of-a-section-using-javascript/</link>
		<comments>http://blogs.infinite-x.net/2010/07/22/changing-column-width-of-a-section-using-javascript/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 07:00:00 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/2010/07/22/changing-column-width-of-a-section-using-javascript/</guid>
		<description><![CDATA[Hi everyone.&#160; Well it’s been a long time since I showed you how to do something horribly unsupported so let’s do something like that today. Background Ad you may know, CRM allows you to pick the layout style for a section within a CRM form.&#160; For the most part, their settings work just fine. In [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone.&#160; Well it’s been a long time since I showed you how to do something horribly unsupported so let’s do something like that today.</p>
<h2>Background</h2>
<p>Ad you may know, CRM allows you to pick the layout style for a section within a CRM form.&#160; For the most part, their settings work just fine.</p>
<p>In January I did a short <a href="http://www.xrmvirtual.com/events/uitipsandtricks" target="_blank">presentation</a> on CRM User Interface tips and tricks for the XRM Virtual User’s group where I reminded everyone that even once you have picked a format for a Section, you can still change the width of the fields labels within the section.</p>
<p>It’s highlighted below:</p>
<p><a href="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_thumb.png" width="404" height="695" /></a> </p>
<p>Unfortunately, it has a maximum value of 250 pixels, which is usually fine, but what if I have a really, really, long label?</p>
<h2>The Scenario</h2>
<p>Let us pretend that I am creating a questionnaire inside CRM to gather some type of relevant data.&#160; I either create a Questionnaire Entity or just add some question attributes to an existing Entity.&#160; Either way, I have a lot of question text and not much room to show it and it might look something like this:</p>
<p><a href="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_thumb_3.png" width="504" height="131" /></a> </p>
<blockquote><p>Note: This is using the default column layout for a Section.</p>
</blockquote>
<p>Notice that my answers are also really small – basically Yes or No, or a short amount of textual information – and they are taking up over 50% of the Section area.</p>
<p>We need to fix that.</p>
<h2>The Solution</h2>
<p>Ok, we’re going to change the column width of both columns within the Section using JavaScript.&#160; But let’s start with a look at the HTML that makes up our Form:</p>
<p><a href="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_thumb_4.png" width="504" height="194" /></a> </p>
<p>CRM uses something called a Column Group ( colgoup ) to help define how the columns of the table are to be sized.&#160; As you can see from the picture above, the column that contains the label is 250 pixels wide and the column that contains our data entry field is 270 pixels wide.</p>
<p>Using the following JavaScript, we can modify those values to be more representative of both the data and the label requirements:</p>
<pre class="code"><span style="color: blue">var </span>tableObj = crmForm.all.new_q1_c.parentNode.parentNode.parentNode;
<span style="color: blue">var </span>col0 = tableObj.getElementsByTagName(<span style="color: maroon">&quot;col&quot;</span>)[0];
<span style="color: blue">var </span>col2 = tableObj.getElementsByTagName(<span style="color: maroon">&quot;col&quot;</span>)[2];

col0.width = <span style="color: maroon">&quot;60%&quot;</span>;
col2.width = <span style="color: maroon">&quot;40%&quot;</span>;</pre>
<h2>How This Works</h2>
<h3>&#160;</h3>
<h3>Step 1: </h3>
<p>First we need to get a handle to our form field’s parent table, which we do with the first line of JavaScript.&#160; <strong>crmForm.all.new_q1_c</strong> is actually the table cell that contains the label of our first form field ( which is the attribute <strong>new_q1</strong>, by the way ).</p>
<p>&#160;</p>
<h3>Step 2:</h3>
<p>Next we need to get the handle to the first and third <strong>col</strong> objects that belong to the parent table which we accomplish by using the getElementsByTagName function.</p>
<p>&#160;</p>
<h3>Step 3:</h3>
<p>Once we have that information, we can set the width of the first column to 60% of the container’s space ( the table ), and set the third column width to 40%.</p>
<p>Your new section layout should look like this:</p>
<p><a href="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.infinite-x.net/images/ChangingColumnWidthofaSectionusingJavaSc_CED2/image_thumb_5.png" width="554" height="91" /></a> </p>
<p>You can change the values for each column to meet your requirements. </p>
<blockquote>
<p>Note: I actually have a question at the bottom of this list that occupies much of the form but it contains customer-specific information so I can’t show it.</p>
</blockquote>
<p>&#160;</p>
<h2>Conclusion</h2>
<p>As I mentioned, this is very unsupported and I can’t guarantee it will work in every circumstance, but it seems to fit the need I had. </p>
<p>Also, If you’re good with jQuery, you can probably do something very similar with less code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2010/07/22/changing-column-width-of-a-section-using-javascript/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Enabling Quick Find of Disabled Records</title>
		<link>http://blogs.infinite-x.net/2009/08/31/enabling-quick-find-of-disabled-records/</link>
		<comments>http://blogs.infinite-x.net/2009/08/31/enabling-quick-find-of-disabled-records/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 18:51:04 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/2009/08/31/enabling-quick-find-of-disabled-records/</guid>
		<description><![CDATA[This week we discovered a requirement to allow the user to perform a Quick Search on both active and close Opportunity records. Engage Incorporated has an article on how to do this, but for some reason, when I tried their technique, it didn’t work.&#160; So, here is my alternative. 1) Export the Entity in question. [...]]]></description>
			<content:encoded><![CDATA[<p>This week we discovered a requirement to allow the user to perform a Quick Search on both active and close Opportunity records. Engage Incorporated has an <a href="http://blogs.engage2day.com/2009/04/include-inactive-records-in-microsoft-crm-40-quick-find/" target="_blank">article</a> on how to do this, but for some reason, when I tried their technique, it didn’t work.&#160; So, here is my alternative.</p>
<p>1) Export the Entity in question. In my case, it was Opportunity.</p>
<p>2) Locate the Quick Find view.</p>
<p>3) Change filter type from this:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">condition </span><span style="color: red">attribute</span><span style="color: blue">=</span>&quot;<span style="color: blue">statecode</span>&quot; <span style="color: red">operator</span><span style="color: blue">=</span>&quot;<span style="color: blue">eq</span>&quot; <span style="color: red">value</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot; <span style="color: blue">/&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>to this:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">condition </span><span style="color: red">attribute</span><span style="color: blue">=</span>&quot;<span style="color: blue">statecode</span>&quot; <span style="color: red">operator</span><span style="color: blue">=</span>&quot;<span style="color: blue">not-null</span>&quot;<span style="color: blue">/&gt;</span></pre>
<p>4) Save the customizations.</p>
<p>5) Import and publish the customizations.</p>
<p>&#160;</p>
<p>This will allow the Quick Find operation to find Opportunity records no matter what their state is ( active, canceled, closed, etc. ).</p>
<p>And yes, this is <strong><em>unsupported</em></strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2009/08/31/enabling-quick-find-of-disabled-records/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changing a Checkbox Attribute&#8217;s Functionality</title>
		<link>http://blogs.infinite-x.net/2009/04/20/changing-a-checkbox-field/</link>
		<comments>http://blogs.infinite-x.net/2009/04/20/changing-a-checkbox-field/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 16:42:58 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/2009/04/20/changing-a-checkbox-field/</guid>
		<description><![CDATA[Each CRM Form field has an OnChange event associated with it that allows you ( the developer ) to execute JavaScript when the user changes the value of the attribute.&#160; This event is fired when you change the attribute’s value and you leave the field – by clicking or using the Tab key. In certain [...]]]></description>
			<content:encoded><![CDATA[<p>Each CRM Form field has an OnChange event associated with it that allows you ( the developer ) to execute JavaScript when the user changes the value of the attribute.&#160; This event is fired when you change the attribute’s value and you leave the field – by clicking or using the Tab key.</p>
<p>In certain instances, I have had bit attributes on the CRM Form which are formatted to display as a Checkbox.</p>
<p>I would like the JavaScript added to the OnChange event to be executed immediately upon the user clicking the checkbox and changing the value. NOT when the user leaves the field.</p>
<p>Using the following code, you can add that functionality:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #0000ff">function</span> ClickMe()</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">{</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">  crmForm.all.new_checkboxfield.FireOnChange();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">}</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none">&#160;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">crmForm.all.new_checkboxfield.attachEvent(<span style="color: #006080">'onclick'</span>,ClickMe, <span style="color: #0000ff">false</span>);</pre>
</p></div>
</div>
<h3>How It Works</h3>
<p>In the Form’s OnLoad event:</p>
<p>1)I create a small JavaScript function called ClickMe that does nothing more than call the OnChange event for the bit attribute we’re working with.</p>
<p>2) I use the JavaScript function <u>attachEvent</u> to attach the ClickMe function to the <strong>onclick</strong> event of the attribute.</p>
<p>Once this code is published, any time the user clicks the checkbox, it will execute the OnChange code for the attribute.</p>
<p>If you need to add this functionality to additional attributes, just duplicate the above code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2009/04/20/changing-a-checkbox-field/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding a toolbar button to create new, related entities</title>
		<link>http://blogs.infinite-x.net/2007/11/09/adding-a-toolbar-button-to-create-new-related-entities/</link>
		<comments>http://blogs.infinite-x.net/2007/11/09/adding-a-toolbar-button-to-create-new-related-entities/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 15:06:53 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/2007/11/09/adding-a-toolbar-button-to-create-new-related-entities/</guid>
		<description><![CDATA[[unsupported] One of my current projects has requirements to add toolbar buttons to allow the user to create a new, related Entity such as a phone call or appointment with a click of a button. Buttons are added to the toolbar by modifying the isv.config.xml and inserting code similar to the following: &#60;Button Title="Phone Call" [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>[unsupported]</em></strong></p>
<p>One of my current projects has requirements to add toolbar buttons to allow the user to create a new, related Entity such as a phone call or appointment with a click of a button.</p>
<p>Buttons are added to the toolbar by modifying the <a href="http://msdn2.microsoft.com/en-us/library/ms934824.aspx" target="_blank">isv.config.xml</a> and inserting code similar to the following:</p>
<pre class="code"><span style="color: rgb(0,0,255)">&lt;</span><span style="color: rgb(128,0,0)">Button</span><span style="color: rgb(255,0,255)">
    </span><span style="color: rgb(255,0,0)">Title</span><span style="color: rgb(0,0,255)">="Phone Call"</span><span style="color: rgb(255,0,255)">
    </span><span style="color: rgb(255,0,0)">ToolTip</span><span style="color: rgb(0,0,255)">="Create a phone call"</span><span style="color: rgb(255,0,255)">
    </span><span style="color: rgb(255,0,0)">Icon</span><span style="color: rgb(0,0,255)">="/_imgs/ico_16_1071.gif"</span><span style="color: rgb(255,0,255)">
    </span><span style="color: rgb(255,0,0)">JavaScript</span><span style="color: rgb(0,0,255)">="locAddRelatedTo(4210);"</span><span style="color: rgb(255,0,255)">
</span><span style="color: rgb(0,0,255)">/&gt;</span></pre>
<p>I would like to point out the JavaScript function <strong>locAddRelatedTo()</strong>.&nbsp; This will open a new window containing a new CRM Entity.&nbsp; The Entity being created is determined by the parameter passed to the function.&nbsp; The parameter is the ID of the Entity in question.&nbsp; In the above example, 4210 is the Entity ID for the Phone Call Activity.&nbsp; Substitute any valid Entity ID to create a new built-in or custom Entity.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2007/11/09/adding-a-toolbar-button-to-create-new-related-entities/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Understanding Entity Ownership in MSCRM 3.0</title>
		<link>http://blogs.infinite-x.net/2006/02/18/understanding-entity-ownership-in-mscrm-30/</link>
		<comments>http://blogs.infinite-x.net/2006/02/18/understanding-entity-ownership-in-mscrm-30/#comments</comments>
		<pubDate>Sun, 19 Feb 2006 00:40:05 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/?p=26</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>When you create a new Entity within MSCRM you have a choice to make regarding the ownership of that Entity.</p>
<p><strong>From the MSCRM 3.0 Help File:</strong></p>
<blockquote><p>In the <strong>Ownership</strong> list, select either:</p>
<ul class="INSTRUCTION_LIST" style="display: block; list-style-type: disc">
<li><strong>User</strong><br />
Records for this entity can be owned by individual users. For example contact records are set to <strong>User</strong>.–   OR –</li>
<li><strong>Organization</strong><br />
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 <strong>Organization</strong>.</li>
</ul>
</blockquote>
<p> </p>
<p>While attending an MSCRM Troubleshooting class last week, I learned something that isn&#039;t readily apparant when you are creating enties:</p>
<p align="center"><strong>In order for a custom entity to be available to the CRM Workflow module, it must be created with an ownership of <u>User</u>.</strong></p>
<p align="left">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&#039;t change the Ownership type after creation, I was looking at spending a few hours deleting my existing Entities and recreating them from scratch. </p>
<p align="left">And after thinking about it, I understand why the ownership requirement for workflow exists, I just wish it had been better documented.</p>
<p>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.</p>
<p> </p>
<p align="center"><span style="color: red"><strong>The following information is provided as-is, without any warranty, either expressed or implied.</strong></span></p>
<p align="center"><span style="color: red"><strong>It is probably unsupported by Microsoft as well.</strong></span></p>
<p align="center"><span style="color: red"><strong>Use this information for reference and as a last-resort.</strong> </span> </p>
<p> </p>
<p><strong>How Entities are Organized</strong> </p>
<p>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 <strong>bold</strong> are specific to that Ownership type.</p>
<table id="table1" cellspacing="1" cellpadding="2" width="75%" border="1">
<tr>
<td align="center" bgcolor="#99ccff" colspan="2"><strong>Organization Ownership</strong></td>
<td align="center" bgcolor="#99ccff" colspan="2"><strong>User Ownership</strong></td>
</tr>
<tr>
<td bgcolor="#99ccff"><strong>Name</strong></td>
<td bgcolor="#99ccff"><strong>Type</strong></td>
<td bgcolor="#99ccff"><strong>Name</strong></td>
<td bgcolor="#99ccff"><strong>Type</strong></td>
</tr>
<tr>
<td>createdby</td>
<td>lookup</td>
<td>createdby</td>
<td>lookup</td>
</tr>
<tr>
<td>createdon</td>
<td>datetime</td>
<td>createdon</td>
<td>datetime</td>
</tr>
<tr>
<td>createdon</td>
<td>datetime</td>
<td>createdon</td>
<td>datetime</td>
</tr>
<tr>
<td>modifiedby</td>
<td>lookup</td>
<td>modifiedby</td>
<td>lookup</td>
</tr>
<tr>
<td>modifiedon</td>
<td>datetime</td>
<td>modifiedon</td>
<td>datetime</td>
</tr>
<tr>
<td>new_2blankoid</td>
<td>primarykey</td>
<td>new_2blankoid</td>
<td>primarykey</td>
</tr>
<tr>
<td>new_name</td>
<td>nvarchar</td>
<td>new_name</td>
<td>nvarchar</td>
</tr>
<tr>
<td>statecode</td>
<td>state</td>
<td>statecode</td>
<td>state</td>
</tr>
<tr>
<td>statuscode</td>
<td>status</td>
<td>statuscode</td>
<td>status</td>
</tr>
<tr>
<td><strong>organizationid</strong></td>
<td><strong>lookup</strong></td>
<td><strong>ownerid</strong></td>
<td><strong>owner</strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><strong>owningbusinessunit</strong></td>
<td><strong>lookup</strong></td>
</tr>
</table>
<p>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&#039;ve successfully performed the following steps and have seen no side effects.</p>
<p><strong>Step 1: Back up your CRM databases.</strong></p>
<p><strong>Step 2: Export All Customizations.</strong></p>
<p>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&#039;t miss anything.</p>
<p><strong>Step 3: Make a backup copy of your exported customizations.</strong></p>
<p>Just in case your edits do not work as planned.</p>
<p><strong>Step 4: Delete the custom entity that needs to be reassigned Ownership.</strong></p>
<p>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.</p>
<p><strong>Step 5: Open the exported customizations in WordPad.</strong></p>
<p>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&#039;t introduce additional line feed characters that so offend CRM.</p>
<blockquote><p><strong>Note:</strong> Steps 6 &#8211; 8 will be repeated for each Entity that needs to be altered.</p>
<p><strong>Note 2:</strong> <u>DO NOT</u> attempt to copy the following XML from this blog and insert it into your CRM Export file. It <u>will break</u> 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.</p></blockquote>
<p><strong>Step 6: Change the ownership type.</strong></p>
<p>Find the following code: </p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">OwnershipTypeMask</span><span style="color: #0000ff">&gt;</span>OrgOwned<span style="color: #0000ff">&lt;/</span><span style="color: #800000">OwnershipTypeMask</span><span style="color: #0000ff">&gt;</span><br />
And replace it with the following:</p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">OwnershipTypeMask</span><span style="color: #0000ff">&gt;</span>UserOwned<span style="color: #0000ff">&lt;/</span><span style="color: #800000">OwnershipTypeMask</span><span style="color: #0000ff">&gt;</span><br />
 </p>
<p><strong>Step 7:  Remove the Organization Attributes and Insert the User Attributes</strong></p>
<p>DELETE THE FOLLOWING CODE</p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OrganizationId&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>lookup<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ReferencedEntityObjectTypeCode</span><span style="color: #0000ff">&gt;</span>1019<br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ReferencedEntityObjectTypeCode</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span>Unique identifier for the organization<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;</span><br />
INSERT THE FOLLOWING CODE</p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OwnerId&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>owner<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsNullable</span><span style="color: #0000ff">&gt;</span>0<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsNullable</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForCreateApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForCreateApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForUpdateApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForUpdateApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">DisplayMask</span><span style="color: #0000ff">&gt;</span>ValidForAdvancedFind|ValidForForm|ValidForGrid<br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">DisplayMask</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span>Owner Id<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OwnerIdDsc&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>int<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsNullable</span><span style="color: #0000ff">&gt;</span>0<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsNullable</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">AttributeOf</span><span style="color: #0000ff">&gt;</span>OwnerId<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AttributeOf</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">XmlAbbreviation</span><span style="color: #0000ff">&gt;</span>dsc<span style="color: #0000ff">&lt;/</span><span style="color: #800000">XmlAbbreviation</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #ff0000"> </span><span style="color: #0000ff">/&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;<br />
</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OwnerIdName&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>nvarchar<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Length</span><span style="color: #0000ff">&gt;</span>320<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Length</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsNullable</span><span style="color: #0000ff">&gt;</span>0<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsNullable</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">AttributeOf</span><span style="color: #0000ff">&gt;</span>OwnerId<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AttributeOf</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">XmlAbbreviation</span><span style="color: #0000ff">&gt;</span>name<span style="color: #0000ff">&lt;/</span><span style="color: #800000">XmlAbbreviation</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsSortAttribute</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsSortAttribute</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span>Name of the owner<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OwnerIdType&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>int<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForCreateApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForCreateApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">IsLogical</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">DisplayMask</span><span style="color: #0000ff">&gt;</span>ObjectTypeCode<span style="color: #0000ff">&lt;/</span><span style="color: #800000">DisplayMask</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">AttributeOf</span><span style="color: #0000ff">&gt;</span>OwnerId<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AttributeOf</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">XmlAbbreviation</span><span style="color: #0000ff">&gt;</span>type<span style="color: #0000ff">&lt;/</span><span style="color: #800000">XmlAbbreviation</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span>Owner Id Type<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;<br />
</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OwningBusinessUnit&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>lookup<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ReferencedEntityObjectTypeCode</span><span style="color: #0000ff">&gt;</span>10<br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ReferencedEntityObjectTypeCode</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span>Unique identifier for the business unit that owns the record<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">attribute</span><span style="color: #ff0000"> PhysicalName<span style="color: #0000ff">=&#034;OwningUser&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span>lookup<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Type</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForCreateApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForCreateApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForUpdateApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForUpdateApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span>1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ValidForReadApi</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">ReferencedEntityObjectTypeCode</span><span style="color: #0000ff">&gt;</span>8<br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">ReferencedEntityObjectTypeCode</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">AggregateOf</span><span style="color: #0000ff">&gt;</span>OwnerId<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AggregateOf</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span>Unique identifier for the user that owns the record.<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Description</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">attribute</span><span style="color: #0000ff">&gt;</span><br />
<strong> </strong></p>
<p><strong>Step 8: Change the form fields from Organization to User.</strong> </p>
<p>DELETE THE FOLLOWING</p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">field</span><span style="color: #ff0000"> name<span style="color: #0000ff">=&#034;organizationid&#034;</span> requiredlevel<span style="color: #0000ff">=&#034;na&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">displaynames</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">displayname</span><span style="color: #ff0000"> description<span style="color: #0000ff">=&#034;Organization Id&#034;</span> languagecode<span style="color: #0000ff">=&#034;1033&#034;</span> </span><span style="color: #0000ff">/&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">displaynames</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">field</span><span style="color: #0000ff">&gt;</span><br />
INSERT THE FOLLOWING</p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">field</span><span style="color: #ff0000"> name<span style="color: #0000ff">=&#034;ownerid&#034;</span> requiredlevel<span style="color: #0000ff">=&#034;na&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">displaynames</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">displayname</span><span style="color: #ff0000"> description<span style="color: #0000ff">=&#034;Owner&#034;</span> languagecode<span style="color: #0000ff">=&#034;1033&#034;</span> </span><span style="color: #0000ff">/&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">displaynames</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">field</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">field</span><span style="color: #ff0000"> name<span style="color: #0000ff">=&#034;owningbusinessunit&#034;</span> requiredlevel<span style="color: #0000ff">=&#034;na&#034;</span></span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">displaynames</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;</span><span style="color: #800000">displayname</span><span style="color: #ff0000"> description<span style="color: #0000ff">=&#034;Owning Business Unit&#034;</span> languagecode<span style="color: #0000ff">=&#034;1033&#034;</span> </span><span style="color: #0000ff">/&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">displaynames</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">field</span><span style="color: #0000ff">&gt;</span></p>
<p><strong>Step 9: Save and close the Export file</strong></p>
<p><strong>Step 10: Import the modified Exported customizations</strong></p>
<p><strong>Step 11: Publish All Customizations</strong></p>
<p>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.</p>
<p><strong>Finished.</strong></p>
<p>Just to make sure everything is fine within the CRM 3.0 system, I perform the additional steps:</p>
<p><strong>Step 12: Add a temporary Attribute to the altered Entity.</strong></p>
<p>This is really just to make sure that the CRM Entity modification process still functions as expected.</p>
<p><strong>Step 13: Add that Attribute to the data entry Form.</strong></p>
<p><strong>Step 14: Publish the Entity</strong></p>
<p><strong>Step 15: Create and save a new record for the altered Entity.</strong></p>
<p><strong>Step 16: Delete the temporary Attribute from the Entity.</strong></p>
<p><strong>Step 17: Publish the Entity.</strong></p>
<p><strong>Really Finished.</strong></p>
<p> </p>
<p>Good luck and if you find any issues, please let me know.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2006/02/18/understanding-entity-ownership-in-mscrm-30/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Researching MSCRM 3.0 Internals</title>
		<link>http://blogs.infinite-x.net/2006/02/18/researching-mscrm-30-internals/</link>
		<comments>http://blogs.infinite-x.net/2006/02/18/researching-mscrm-30-internals/#comments</comments>
		<pubDate>Sat, 18 Feb 2006 21:13:04 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/?p=36</guid>
		<description><![CDATA[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: &#60;Project xmlns=&#034;http://schemas.microsoft.com/developer/msbuild/2003&#034; &#62;   &#60;ItemGroup&#62;     &#60;Item Include=&#034;*/**&#034; /&#62;   &#60;/ItemGroup&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.microsoft.com/Businesssolutions/Community/Newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.crm.developer&#038;lang=en&#038;cr=US">Microsoft Business Solutions CRM Developer</a> Newsgroup, <a href="http://geekswithblogs.net/insidemscrm/">Arne Janning</a> 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.</p>
<p>Open Notepad and create a file that looks like this:</p>
<p><span style="color: #0000ff">&lt;</span><span style="color: #800000">Project</span><span style="color: #ff0000"> xmlns<span style="color: #0000ff">=&#034;<a href="http://schemas.microsoft.com/developer/msbuild/2003">http://schemas.microsoft.com/developer/msbuild/2003</a>&#034; <span style="color: #0000ff">&gt;</span><br />
  <span style="color: #0000ff">&lt;</span><span style="color: #800000">ItemGroup</span><span style="color: #0000ff">&gt;</span><br />
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Item</span><span style="color: #ff0000"> Include<span style="color: #0000ff">=&#034;*/**&#034;</span> </span><span style="color: #0000ff">/&gt;</span><br />
  <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ItemGroup</span><span style="color: #0000ff">&gt;</span><br />
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Project</span><span style="color: #0000ff">&gt;</span><br />
 </span></span><span style="color: #ff0000"><span style="color: #0000ff"> </span></span></p>
<blockquote><p><strong>Note:</strong> 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 &#034;pretty&#034; quotes. VS doesn&#039;t like the fancy quotes and will give you errors when you attempt to open the file.</p></blockquote>
<p>Save this with a <strong>.csproj</strong> 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&#039;t do anything unwise like saving any of the files. We don&#039;t want to run the risk of upsetting CRM in any way &#8211; or damaging the files and rendering the site unusable.</p>
<p>I also hope I don&#039;t need to state that it is a really bad idea to do this to a production server, do I?</p>
<p> </p>
<p><strong>References:</strong></p>
<p><a href="http://www.microsoft.com/Businesssolutions/Community/Newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.crm.developer&#038;mid=ca2cdeff-14db-4169-bf04-74da22fc8932&#038;sloc=en-us">CRM Developer Newsgroup Post</a></p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2006/02/18/researching-mscrm-30-internals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Including custom JavaScript files in MSCRM 3.0</title>
		<link>http://blogs.infinite-x.net/2006/02/18/including-custom-javascript-files-in-mscrm-30/</link>
		<comments>http://blogs.infinite-x.net/2006/02/18/including-custom-javascript-files-in-mscrm-30/#comments</comments>
		<pubDate>Sat, 18 Feb 2006 20:36:50 +0000</pubDate>
		<dc:creator>Mitch Milam</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Dynamics CRM]]></category>
		<category><![CDATA[Unsupported]]></category>

		<guid isPermaLink="false">http://blogs.infinite-x.net/?p=37</guid>
		<description><![CDATA[The more you get into MSCRM development, the more you will probably realize that you are writing quite a bit of JavaScript to control various aspects of the CRM Client experience.  As most programmers find, the more code you write, the more you write code.  You also start developing a code library containing your most often used functions [...]]]></description>
			<content:encoded><![CDATA[<p>The more you get into MSCRM development, the more you will probably realize that you are writing quite a bit of JavaScript to control various aspects of the CRM Client experience.  As most programmers find, the more code you write, the more you write code.  You also start developing a code library containing your most often used functions so that you don&#039;t have to rewrite them each time you need them.</p>
<p>In most programming languages, the concept of an <strong>Include File</strong> exists. Include files are usually referenced at the beginning of your source code file and are merely instructions to your compiler, interpreter, or whatever, to include the contents of that file within your program. </p>
<p>This allows you to create a library of related sub-routines or functions that can be referenced from any number of other programs. Since you only have one copy of those routines, it cuts down on your maintenance requirements.</p>
<p><strong><em>So how does any of this relate to MSCRM?</em></strong></p>
<p>MSCRM version 3.0 gives you the ability to peform actions when the value of a form field changes &#8211; the <a href="http://msdn.microsoft.com/library/en-us/CrmSdk3_0/htm/v3d0fieldeventsonchange.asp">OnChange</a> Event.  This allows you to take action whenever a user changes a particular form.  Take a look at this example:</p>
<p><img src="http://blogs.infinite-x.net/images/jsinclude01.jpg" /></p>
<p>The OnChange events for both Price and Quantity contain the following JavaScript code to automatically add the two fields together:</p>
<blockquote><p>crmForm.all.new_total.DataValue=<br />
crmForm.all.new_price.DataValue*<br />
crmForm.all.new_quantity.DataValue </p></blockquote>
<p>This is really not very much code and there are really only two fields involved so it&#039;s pretty easy to maintain.  But, what happens if you have five or ten fields to calculate. That really becomes work at that point, and it can create a maintenance nightmare as well.</p>
<p>You can solve this problem by putting the above JavaScript into a file on disk and include that file in the Form&#039;s <a href="http://msdn.microsoft.com/library/en-us/CrmSdk3_0/htm/v3d0formeventsonload.asp">OnLoad</a> event.  Here&#039;s how it will work:</p>
<p> </p>
<p><strong>Create the .js file:</strong></p>
<p>Open Notepad and copy the following Javascript into it</p>
<blockquote><p>function OrderFormAdd()<br />
{<br />
   crmForm.all.new_total.DataValue=<br />
   crmForm.all.new_price.DataValue*<br />
   crmForm.all.new_quantity.DataValue <br />
}</p></blockquote>
<p>Save this file as myfunctions.js and place it in a directory below your MSCRM web directory called <strong>myscripts</strong>.</p>
<p> </p>
<p><strong>Reference your .js file:</strong></p>
<p>In the OnLoad event of your Form, include the following code: </p>
<blockquote><p>var script = document.createElement(&#039;script&#039;);<br />
script.language = &#039;javascript&#039;;<br />
script.src = &#039;/myscripts/myfunctions.js&#039;;<br />
document.getElementsByTagName(&#039;head&#039;)[0].appendChild(script);</p></blockquote>
<p> </p>
<p><strong>Update the OnChange Events:</strong></p>
<p>Now we need to update the OnChange events for the Price and Quantity fields. Remove the existing JavaScript and replace it with the following:</p>
<blockquote><p>OrderFormAdd();</p></blockquote>
<p> </p>
<p>Save and publish your form and you are done.  From now on, any time you need to modify the calculation on the Order Form, just edit the myfunctions.js file. No additional work needs to be done to the CRM Form.</p>
<p><strong>Note:</strong></p>
<ul>
<li>If you make a change to the .js file and you don&#039;t see the change take effect, delete your browser&#039;s temporary Internet files and try it again. The client can cache the .js and it will be using the older copy instead of the newly updated master copy.</li>
</ul>
<p> </p>
<p><strong>Using Included Functions in the Form OnLoad Event:</strong></p>
<p>It was pointed out by &#034;Alex&#034; who wrote the actual JavaScript include code that it is possible to run into a timing issue because the include file has not yet finished appending to the CRM Form.  This is really only a problem if you need to access a function from your include file from within the OnLoad event.</p>
<p>To circumvent this issue, we need to wait for the script&#039;s state to change to &#034;loaded&#034; before any functions in the include file can be accessed:</p>
<blockquote><p>var script = document.createElement(&#039;script&#039;);<br />
script.language = &#039;javascript&#039;;<br />
script.src = &#039;/myscripts/myfunctions.js&#039;;<br />
document.getElementsByTagName(&#039;head&#039;)[0].appendChild(script);</p>
<p>var f = function()<br />
{<br />
  if (event.srcElement.readyState == &#034;loaded&#034;)<br />
   SomeFunction(); // some function from MyFunctions.js<br />
}</p>
<p>script.attachEvent(&#034;onreadystatechange&#034;, f);</p></blockquote>
<p> </p>
<p><strong>Additional Notes:</strong></p>
<p>This solution will <strong><u>not</u></strong> work if you have the CRM 3.0 Outlook Laptop Client deployed. This is because the Laptop client utilizes a local Web server and if physically disconnected from the main CRM web server, the JavaScript file will be unavailable and a script error on the page will result.</p>
<p>In addition, since the JavaScript file is not actually part of the CRM system, it is not replicated to the Laptop client during syncronization.</p>
<p>Michaeljon Miller has a <a href="http://blogs.msdn.com/mikemill/archive/2006/03/02/542387.aspx">post</a> discussing CRM SDK access while offline.</p>
<p> </p>
<p><strong>References:</strong></p>
<p>The JavaScript code for this article was taken from a newsgroup conversation between <a href="http://ronaldlemmen.blogspot.com/">Ronald Lemmen</a> and &#034;Alex.&#034;  Please consult the original thread for context.</p>
<p><a href="http://www.microsoft.com/Businesssolutions/Community/Newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.crm.developer&#038;mid=1e20802f-2c75-4147-b708-89f8a4dee6a4&#038;sloc=en-us">CRM Developer Newsgroup Post</a></p>
<p><a href="http://blogs.msdn.com/mikemill/archive/2006/03/02/542387.aspx">Using the CRM SDK offline</a></p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infinite-x.net/2006/02/18/including-custom-javascript-files-in-mscrm-30/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

