<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>David McDonald's Dynamics Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dmcdonald/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dmcdonald/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 05:51:07 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Opening URL Addressable Forms to Create new Related Records</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/opening-url-addressable-forms-to-create-new-related-records</link>
      <pubDate>Tue, 15 May 2012 21:18:19 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2012/05/15/opening-url-addressable-forms-to-create-new-related-records/</guid>
      <description><![CDATA[Since the beginning of time CRM has had URL addressable forms.&#160; This features makes it possible...]]></description>
      <content:encoded><![CDATA[<p>Since the beginning of time CRM has had URL addressable forms.&#160; This features makes it possible to consistently open an existing CRM entity form from script or from other programs simply by passing a series of mysterious URL parameters to the CRM website.&#160; And that is the key – those pesky and mysterious URL parameters.&#160; For simple use cases, the parameters are actually <a href="https://technet.microsoft.com/en-us/library/gg328483" target="_blank">pretty well documented in the CRM SDK</a>.&#160; </p>  <p>The purpose of this post is to show how to pass parameters when you want a button on a parent form that will open a new related record form.&#160; This seems like it would be a common use case, but I found it hard to find any really clear example of how to do this.&#160; A few articles <a href="https://community.dynamics.com/product/crm/crmtechnical/b/crminogic/archive/2009/03/06/shortcut-to-add-new-records-for-related-entities.aspx" target="_blank">here</a> and <a href="https://community.dynamics.com/product/crm/crmtechnical/b/crminogic/archive/2011/08/25/add-a-button-to-create-a-new-related-record.aspx" target="_blank">here</a> were helpful but I still spent over an hour trying to work this out for myself.&#160; So in the interest of supporting the community and perhaps saving others an hour or more trying to figure this out on their own, I thought that I’d blog it.&#160; </p>  <p>My use case is pretty simple.&#160; I want a button called Check-In on the Contact Form (see fig.1).&#160; When I click the button, it will open a new custom entity (called rmtc_monthlyclubbookresponse) form with the related contact already filled in (see fig.2).&#160; </p>    <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody>     <tr>       <td valign="top" width="201"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/1374.image_5565EF69.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/1374.image_5F00_5565EF69.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/2376.image_thumb_5B409302.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/2376.image_5F00_thumb_5F00_5B409302.png" width="308" height="267" /></a>          <hr />Figure 1 – Check-in button on the form.</td>        <td valign="top" width="199"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/8750.image_5348F0A0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/8750.image_5F00_5348F0A0.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/0724.image_thumb_644D1E83.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/0724.image_5F00_thumb_5F00_644D1E83.png" width="399" height="236" /></a>          <hr />Figure 2 – Create new related entity form.</td>     </tr>   </tbody></table>      <p>The first step to create this is to add the button to the Contact form.&#160; I prefer to use the Visual Ribbon Editor tool that you can pick up on Codeplex.&#160; My approach is to have the button call a webresource javascript script that will open a new browser window, passing the correct parameters.&#160; In the visual editor I added an action for my button to call my javascript webresource (see fig.3).&#160; I reference my webresource library as: </p>  <blockquote>   <h6><em>$webresource:rmtc_/Scripts/toolbarCommands</em></h6>  </blockquote>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/6505.image_38302192.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/6505.image_5F00_38302192.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/2870.image_thumb_36EB88B3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/2870.image_5F00_thumb_5F00_36EB88B3.png" width="319" height="277" /></a>Figure 3. – Visual Ribbon Editor reference to script webresource.</p>  <p>Now for the tricky part – the code to set the correct parameters and to open a new IE window with the related entity form.&#160; I will show you the finished code, and not bore you with the details of how I got it (it is probably what you want anyhow).&#160;&#160;&#160; <div class="csharpcode">     <pre class="alt"><span class="lnum">   1:  </span>function Checkin() {</pre>

    <pre><span class="lnum">   2:  </span>    var serverUrl;</pre>

    <pre class="alt"><span class="lnum">   3:  </span>    var errorMessage = <span class="str">&quot;Context is not available.&quot;</span>;</pre>

    <pre><span class="lnum">   4:  </span>    var context;</pre>

    <pre class="alt"><span class="lnum">   5:  </span>    <span class="kwrd">if</span> (<span class="kwrd">typeof</span> GetGlobalContext != <span class="str">&quot;undefined&quot;</span>) {</pre>

    <pre><span class="lnum">   6:  </span>        context = GetGlobalContext();</pre>

    <pre class="alt"><span class="lnum">   7:  </span>    }</pre>

    <pre><span class="lnum">   8:  </span>    <span class="kwrd">else</span> {</pre>

    <pre class="alt"><span class="lnum">   9:  </span>        <span class="kwrd">if</span> (<span class="kwrd">typeof</span> Xrm != <span class="str">&quot;undefined&quot;</span>) {</pre>

    <pre><span class="lnum">  10:  </span>            context = Xrm.Page.context;</pre>

    <pre class="alt"><span class="lnum">  11:  </span>        }</pre>

    <pre><span class="lnum">  12:  </span>        <span class="kwrd">else</span> {</pre>

    <pre class="alt"><span class="lnum">  13:  </span>            alert(errorMessage);</pre>

    <pre><span class="lnum">  14:  </span>            <span class="kwrd">return</span>;</pre>

    <pre class="alt"><span class="lnum">  15:  </span>        }</pre>

    <pre><span class="lnum">  16:  </span>    }</pre>

    <pre class="alt"><span class="lnum">  17:  </span>    var entityId = context.getQueryStringParameters().id</pre>

    <pre><span class="lnum">  18:  </span>    var entityEtc = context.getQueryStringParameters().etc</pre>

    <pre class="alt"><span class="lnum">  19:  </span>    var serverUrl = context.getServerUrl();</pre>

    <pre><span class="lnum">  20:  </span>&#160;</pre>

    <pre class="alt"><span class="lnum">  21:  </span>    <span class="kwrd">if</span> (serverUrl.match(/\/$/)) { serverUrl = serverUrl.substring(0, serverUrl.length - 1); }</pre>

    <pre><span class="lnum">  22:  </span>    var recordUrl = serverUrl + <span class="str">&quot;/main.aspx?&quot;</span>;</pre>

    <pre class="alt"><span class="lnum">  23:  </span>    var <span class="kwrd">params</span> = <span class="str">&quot;etn=rmtc_monthlyclubbookresponse&quot;</span>;</pre>

    <pre><span class="lnum">  24:  </span>    <span class="kwrd">params</span> += <span class="str">&quot;&amp;pagetype=entityrecord&quot;</span>;</pre>

    <pre class="alt"><span class="lnum">  25:  </span>    <span class="kwrd">params</span> += <span class="str">&quot;&amp;extraqs=&quot;</span> + encodeURIComponent(<span class="str">&quot;?_CreateFromId=&quot;</span> + entityId + <span class="str">&quot;&amp;_CreateFromType=&quot;</span> + entityEtc) </pre>

    <pre><span class="lnum">  26:  </span>    var URL = recordUrl + <span class="kwrd">params</span>; </pre>

    <pre class="alt"><span class="lnum">  27:  </span>    window.open(URL, <span class="str">&quot;_blank&quot;</span>, <span class="str">&quot;width=900px,height=600px,resizable=1&quot;</span>);</pre>

    <pre><span class="lnum">  28:  </span>&#160;</pre>

    <pre class="alt"><span class="lnum">  29:  </span>}</pre>
  </div>
  </p>

<p>Please note that I liberally borrowed pieces of this code from other places.&#160; The key item to look at is line 25.&#160; CRM supports a URL parameter called <strong>extraqs</strong>.&#160; This is used to pass custom parameters to forms.&#160; It turns out that there are two sub-parameters, <strong>_CreateFromId</strong>&#160; and <strong>_CreateFromType</strong> that can be use to pass the related record information into the new entity form.&#160; You will note that the underscore is required.&#160; Also note that you must URI Encode the parameters and that it begins with a required question mark “?”.&#160; </p>

<p>The _CreateFromId parameter is the entity ID of the contact record in my case.&#160; It is easily picked up from the context.&#160; The _CreateFromType is the entity type code of the parent entity, which is contact in my case.&#160; Hardcode that at your own risk, as these type codes will change from one organization to another.&#160; To do it right, I also pick up the ETC from the query string in the context.&#160; </p>

<p>The final stage is to cruft up the URL line 26 and call Window.Open passing in our new URL.&#160; CRM takes it from there, opening the related entity form and pre-filling the lookup field of the contact entity (figure 2). You can see the parameters passed to your form in the IE address bar by pressing CTRL-N.&#160;&#160; </p>

<p>Hopefully this is going to save you some time trying to decipher these query string parameters on your own.&#160; As always, please leave me feedback if I missed something or if this helped you.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>CRM–Drag and Drop not working</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/crmdrag-and-drop-not-working</link>
      <pubDate>Tue, 17 Apr 2012 11:35:24 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2012/04/17/crmdrag-and-drop-not-working/</guid>
      <description><![CDATA[There are a few places in the CRM UI where drag-drop are used.&#160; One place where this occurs is...]]></description>
      <content:encoded><![CDATA[<p>There are a few places in the CRM UI where drag-drop are used.&#160; One place where this occurs is when you resize the columns in a grid view.&#160; Another obvious place for drag and drop is in the forms designer.&#160; The system customizer can drag and drop attributes onto their forms and use the mouse to position them on the form.&#160; </p>  <p>This all works great 99.9% of the time.&#160; But today I received an email from a customer where these drag and drop features were not working.&#160; Not only didn’t it work on this gentleman’s computer, but it was broken on every other computer in their office.&#160; So I did a bit of research and some testing and found the problem.&#160; </p>  <p>It turns out that this is not a CRM 2011 issue at all.&#160; Drag and drop is a setting in IE that can be turned off.&#160; See the picture below.&#160; In some large organizations, especially ones that are zealots about security, they may have pushed down a group policy to disable drag and drop.&#160; That was the problem in this case – the IT department had disabled drag and drop in IE.&#160; A simple IE setting change fixes the problem (or in their case, a business case justification with IT Security to change their group policy setting).&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/5468.clip_image002_3EE68CA9.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/5468.clip_5F00_image002_5F00_3EE68CA9.jpg"><img style="float: right; display: inline; background-image: none;" title="clip_image002" border="0" alt="clip_image002" align="right" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/7115.clip_image002_thumb_6952BDC6.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/7115.clip_5F00_image002_5F00_thumb_5F00_6952BDC6.jpg" width="366" height="82" /></a>If you are using CRM Online, ensure that the setting for the Internet Zone is set to enable Drag/Drop.&#160; If you are using CRM On Premise then it would be the local intranet zone.&#160; In either case, the setting is in the miscellaneous section on IE Options/Security/Settings for the zone.&#160; Here is a screen shot of the setting.&#160; </p>  <p>Hopefully this will save some other folks some time in the future.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>Dynamics CRM Developer Portal</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/dynamics-crm-developer-portal</link>
      <pubDate>Sun, 26 Feb 2012 12:57:50 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2012/02/26/dynamics-crm-developer-portal/</guid>
      <description><![CDATA[Microsoft Dynamics CRM Developer Portal is an excellent resource for anyone who is customizing CRM...]]></description>
      <content:encoded><![CDATA[<p><a href="https://crm.dynamics.com/developer"><img style="display: inline; background-image: none;" title="Dev Portal" border="0" alt="Dev Portal" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/26/42/metablogapi/1031.Dev-Portal_0B1#1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-26-42-metablogapi/1031.Dev_2D00_Portal_5F00_0B123001.png" width="260" height="61" />Microsoft Dynamics CRM Developer Portal</a> is an excellent resource for anyone who is customizing CRM or building XRM solutions. I ran across this site a while back and frankly I had forgotten all about it.&#160; It is worth posting again because it is such an excellent resource. It has links to the latest <a href="https://www.microsoft.com/download/en/details.aspx?id=24004" target="_blank">CRM SDK</a>, the <a href="https://blogs.msdn.com/b/crm/" target="_blank">CRM Team Blog</a>, and even the <a href="https://www.youtube.com/MSdynamCRM" target="_blank">CRM 2011 Youtube Channel</a>.&#160; </p>  <p>Check it out!</p>]]></content:encoded>
    </item>
    <item>
      <title>How to Federate Dynamics CRM</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/how-to-federate-dynamics-crm</link>
      <pubDate>Thu, 25 Jun 2009 16:35:16 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2009/06/25/how-to-federate-dynamics-crm/</guid>
      <description><![CDATA[Microsoft CRM Guru Rich Carr has written a great article about how to Federate CRM between systems...]]></description>
      <content:encoded><![CDATA[<p><a href="https://blogs.msdn.com/crm/pages/bio-rich-carr.aspx" target="_blank">Microsoft CRM Guru Rich Carr</a> has written a great article about how to Federate CRM between systems or tenants.&#160; He is my first “guest blogger” and here is his article.</p>  <p>&#160;</p>  <h2>Federated or Multi-tenant Implementations – How to Sync 1 CRM system to another!</h2>  <p>There are some large implementations of CRM that are global enough to consider a federated approach to their implementation. There are also some implementations of XRM where 1 or more entities need to be synced between the tenants in the solution. Then there are a few instances where people may want to go from onPremise to online.</p>  <p>Each one of these scenarios can be solved with variations of the code in this blog.</p>  <p>What started me down this path was curiosity about migrating from onPremise to onLine. There were plenty of whitepapers and documents on going from onLine to onPremise, but nothing going the other way. Research led me to the fact that you have to either Scribe, or try to write some custom .NET code instead.</p>  <p>Given that I love to write .NET code, easy choice. But I certainly didn’t want to hardcode everything!! I started to look at the helper classes and the dynamicentitypartialtype.cs file became the anchor of the solution. If you haven’t tried this helper class out yet, try it – the class is pretty cool. Being a self taught C# coder I spent a little time trying to figure out how it was invoked from the sample code since there was no instantiation of the class. Finally I just ran it and realized that because of how it was constructed that it “just starts” all by itself whenever you instantiate an entity that is a DynamicEntity! </p>  <p>That was cool – but when I tried to add the class to my project with 2 different CrmSdk references, all hell broke loose. The namespace on the class is CrmSdk - since the result of the partial type class was the ability to build a dynamic entity on the fly, and it is a target dynamicentity that I want to create (not source) , I decided to put that class in the same namespace as the target CrmSdk, resulting in:</p>  <blockquote>   <p>namespace CrmSdkTarget;</p> </blockquote>  <p>A little more digging to figure out how it really worked and I came across the code where it takes the passed in value and creates an object of the correct type and places the passed in value where it was supposed to go. If you have tried to update or create an entity through the dynamicentity route you have found where an attribute of a certain property has to be set to a value of the correct type. As an example, in order to create a property of type CrmLookupProperty that you have to first create a CrmLookup object and then set the value property of the CrmLookupProperty to this object, like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> Lookup myLU = <span style="color: #0000ff">new</span> Lookup();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> myLU.name = “John Smith”;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> myLU.Type = “contact”;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> myLU.<span style="color: #0000ff">value</span> = “348145F4-B2F3-DD11-BCF9-00C09F2C80B1”;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> LookupProperty myLUProp = <span style="color: #0000ff">new</span> LookupProperty();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> myLUProp.Name = “contactid”;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> myLUProp.Value = myLU;</pre>
<!--CRLF--></div>
</div>

<p></p>

<h3>Authentication</h3>

<p>In my solution I had 2 web references – one called CrmSdkTarget which was for my target – and one called CrmSdkSource which was my source. I called 2 different routines to get an instance of each and inside each routine is the authentication required of each. When I first wrote this I was going from a VPC image on my laptop to my own online system so I needed one AD authentication and one Live. Changing this part of the code should be trivial to match your authentication requirements.</p>

<h3>When is DynamicEntity NOT equal to a DynamicEntity?</h3>

<p>This is really the crux of the problem. You have an account on system A and want to sync it to system B. In one .NET project you can set up web references to both of the systems and authenticate to them easy enough – but you still can’t grab an account object as a DynamicEntity from System A and set a DynamicEntity from System B equal to it. What’s worse is that when you do anything in your code you have to qualify what you are doing because you now have multiple references to the same object.</p>

<p>In order for this to work I had to add the reference to the Source CrmSdkSource to the dynamicentitypartialtype class – which caused every reference to CrmSdk objects to turn red and ugly because of VS not knowing which one I meant.</p>

<p>So something like:</p>

<blockquote>
  <p>Public static object GetPropertyValue(Property property) </p>
</blockquote>

<p>becomes</p>

<blockquote>
  <p>Public static object GetPropertyValue(CrmSdkTarget.Property property) </p>
</blockquote>

<p>Every single reference to a CRM object had to be typed correctly. Since you can download my code, you don’t have to do it!</p>

<p>Next I tackled the real meat of the solution – the code in the CreateInstance method. This code is where an object is passed and turned into a CRM DynamicEntity Property. Once again – a CrmSdkTarget.Lookup object does NOT equal a CrmSdkSource.Lookup object! So in order for this to work I had to build a CrmSdkTarget.Lookup object by getting the values out of the CrmSdkSource.Lookup object.</p>

<p>This same concept was applied for each CRM property type. The place where things a little more interesting is the DynamicEntityProperty – the property used by activities for things like email to’s and from’s. That can actually be several properties in 1 so the code is a lot messier. Also where it gets confusing is that not all properties on an activityparty are ok for create. For instance while processing the <b><i>to</i></b> property for emails the source system will pass you a property within the dynamicentityproperty for <b><i>donotfax</i></b>. That is not a valid property for create.</p>

<h3>Excluding other properties</h3>

<p>In the main driver program there were more issues similar to the<b><i> to</i></b> for emails – not every property is ok for create. For instance any of the created and modified properties are read only fields. So I added a switch to exclude these fields. I called the metadata service to get a list of which fields are valid for create and created an ArrayList full of them. The driver program looks at each property in the source and if it is in the ArrayList, it passes it on for creation on the target side.</p>

<p>Finally the code that is used to grab all of the accounts or other entities is pretty much straight from the SDK. </p>

<h3>A couple more Gotcha’s</h3>

<p>If you are migrating a fully used system then there is a definite order that is required for your migration. For instance Lead has to be done before Account because Accounts have a field called originatingleadid that will throw an error if the lead doesn’t exist yet. There are countless other instances of this. Some of them have to be handled by watching the order – and some a little different.</p>

<p>One that is a little different is the primarycontactid field on account. In my solution I load an account and then save off the primarycontactid field. I then process all of the contacts for the account I just processed and when I find the one that has the same GUID as my saved off primarycontactid, I do an account update.</p>

<p>Another gotch is status and statecode’s. After you create the entity in many cases you have to call a SetState message to get the status to be something other than “New”. The code here accounts for that for all of the entities that are covered.</p>

<p>Finally – activities are just a strange beast no matter how you slice it. A source system will give you a cc or bcc with nothing in it, and creating that same thing isn’t easy. What I decided to do is to check the length of the dynamicentity array and if it is greater than 0 deal with it, otherwise don’t even send it to the target system.</p>

<h3>Federation and Multi-Tenancy Timing Considerations</h3>

<p>In these scenarios while there are a few options I think I can make a case that there is only one real option. The one option using this code that I would not suggest is to use plug-ins. I don’t suggest this for two reasons – the first is that a web service dynamic entity is not the same as the ICrmService that you get when you do a plug-in. While this is a minor inconvenience and I’m sure could be overcome – the larger issue is one that is more serious.</p>

<p>My background for CRM is in auditing. When you are doing an audit application you cannot “miss” a transaction. As soon as you do that, your application isn’t worth anything. I don’t see anything any different with trying to keep information in sync than in auditing. If you “miss” a transaction, then it is gone and you can’t ever get it back. The one you “miss” could be the one that updates the most important piece of information that someone else really needed to have. Once users lose confidence in your application, then it is a real bear to get it back. How could you “miss” one with a plug-in? If the target system is down for maintenance, in the middle of an IISReset or something similar then your create or update will fail.</p>

<p>So the solution is to ensure delivery by offloading the process. Step 1 is to create a plug-in that just writes out the transaction to a table in a non CRM database. Grab the transaction type, objectId, ObjectTypeCode, preXml, PostXML and timestamp it. If the database write fails, write it all out to a text file. This should never fail to capture the transaction and save it for later processing.</p>

<p>Step 2 is to create a windows service that has a timer. When the timer goes off – first look for text files and then look to the database. Load the text files into the database to ensure first in first out processing.</p>

<p>Step 3 is to create a DLL that the windows service can call that actually does the work – and pass it the transaction. Let that .dll have the multiple web references and be the workhorse. Sprinkle in some heavy duty logging and notifications to folks should things stop working and you have a solution that you know won’t miss any transactions.</p>

<p>The code for this article is <a href="https://code.msdn.microsoft.com/CRMCodeSync" target="_blank">posted on MSDN Code Gallery</a>.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>XRM in the News</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/xrm-in-the-news</link>
      <pubDate>Tue, 16 Jun 2009 17:58:19 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2009/06/16/xrm-in-the-news/</guid>
      <description><![CDATA[XRM made the news this week thanks to Mary-Jo Foley’s article “Microsoft takes off its xRM...]]></description>
      <content:encoded><![CDATA[<p>XRM made the news this week thanks to Mary-Jo Foley’s article “<a href="https://blogs.zdnet.com/microsoft/?p=3053" target="_blank">Microsoft takes off its xRM platform-as-a-service gloves</a>”.&#160; </p>  <p>My team wanted to put more context around XRM for our Public Sector customers.&#160; Many customers are familiar with CRM software, but XRM is a new idea.&#160; So I was honored to be a guest blogger on our Microsoft State and Local Government blog – <a href="https://bit.ly/TE86C" target="_blank">Bright Side of Government</a>.&#160; In my <a href="https://bit.ly/17mrsY" target="_blank">guest blog post</a> I explain more about XRM, how it is the platform that underlies our CRM product, and how our customers and partners are using it to build awesome applications for government.&#160; </p>  <p>Check it out.&#160; But please don’t make fun of my picture!&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>CRM 4.0 VPC 2009 Networking Fix</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/crm-4-0-vpc-2009-networking-fix</link>
      <pubDate>Mon, 25 May 2009 22:42:02 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2009/05/25/crm-4-0-vpc-2009-networking-fix/</guid>
      <description><![CDATA[On April 18th we released a new Dynamics CRM 4.0 VPC to our partners.&#160; I love a lot about the...]]></description>
      <content:encoded><![CDATA[<p>On April 18th we released a new <a href="https://mbs.microsoft.com/partnersource/deployment/methodology/vpc/MSD_CRM4VPCApril09" target="_blank">Dynamics CRM 4.0 VPC</a> to our partners.&#160; I love a lot about the new VPC including tons of data, dashboards, and pre-configured <a href="https://www.codeplex.com/crmaccelerators" target="_blank">CRM Accelerators</a>.&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dmcdonald/WindowsLiveWriter/CRM4.0VPC2009NetworkingFix_13F35/image_2.png" original-url="https://blogs.msdn.com/blogfiles/dmcdonald/WindowsLiveWriter/CRM4.0VPC2009NetworkingFix_13F35/image_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="CRM 4.0 Dashboard Screenshot" border="0" alt="CRM 4.0 Dashboard Screenshot" align="left" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dmcdonald/WindowsLiveWriter/CRM4.0VPC2009NetworkingFix_13F35/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/dmcdonald/WindowsLiveWriter/CRM4.0VPC2009NetworkingFix_13F35/image_thumb.png" width="304" height="216" /></a></p>  <p>It took me several weeks to find the time to get to really work with the image.&#160; I needed it last week to delve into the Event Management Accelerator for a customer.&#160;&#160;&#160; I am impressed with many things about it – it is faster and more complete than any previous VPC that I’ve seen.&#160; I’m also glad to have Visual Studio 2008 with .NET 3.5 SP1 installed.&#160; And having SQL Server 2008 is an added bonus.&#160; </p>  <p>Anyway, all of this brings me to the purpose of this post.&#160; I was planning to add an enhancement to the image around integrating Virtual Earth with CRM when I realized that I didn’t have an internet connection from within the VPC image.&#160; It took me quite a while to figure out how to get the internet access working correctly and so I thought that I’d share that info with the community.&#160; </p>  <p>The simple answer is that the default “Local Area Connection” has a hard-coded IP address, gateway, and DNS server.&#160; You should blank out the Default gateway setting.&#160; This forces the VPC to use the gateway from “Local Area Connection 2”.&#160; Local Area Connection 2 should be mapped to your host PC’s active internet connection.&#160; </p>  <p>I spent quite a while trying to enable one connection and disabling the other.&#160; CRM requires the hardcoded internet IP address connection but the gateway was preventing windows server from accessing your true internet gateway via the second adapter.&#160; So, blanking out the gateway was all that it took to fix the problem.&#160; </p>  <p>Hopefully this will save someone else time.&#160;&#160; If you haven’t done so, I strongly recommend that you download and check out the new image.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>Application Lifecycle Management</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/application-lifecycle-management</link>
      <pubDate>Sat, 11 Apr 2009 09:20:39 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2009/04/11/application-lifecycle-management/</guid>
      <description><![CDATA[I noticed that last week we posted a new David Chappell whitepaper - “Application Lifecycle...]]></description>
      <content:encoded><![CDATA[<p>I noticed that last week we posted a new David Chappell whitepaper - “<a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=b4765f41-a2c2-41e4-a1da-b35e1f502ef6">Application Lifecycle Management</a>”.&#160;&#160; I read all of David’s papers because I find that he has an incredible talent for clarifying and simplifying concepts in our industry.&#160; ALM is a term that I have been hearing increasingly in discussions with our customers and partners and in the media.&#160; </p>  <p>The Wikipedia definition reports that <a href="https://en.wikipedia.org/wiki/Application_Lifecycle_Management">ALM is the marriage of business management and software development</a>.&#160; The “ALM Lifecycle Management” whitepaper takes a much broader view than most of the industry.&#160; It proposes that ALM encompasses the entire lifespan of an application, not merely the software development lifecycle.&#160; ALM includes the entire time that the organization is spending money on the application.&#160; </p>  <p>I have seen this pattern over and over again in our industry.&#160; Tools that support ALM are not new, but I think that the term ALM is.&#160; Of course&#160; tools supporting SDLC activities have been around for many years.&#160; But there is a certain buzz that is happening with ALM these days. The big analysis firms are now evaluating ALM tools.&#160; You can read Gartner’s <a href="https://mediaproducts.gartner.com/reprints/microsoft/vol4/article7/article7.html">report online</a>.&#160;&#160; </p>  <p>With any new category there is often some early confusion about the category definition. I think that David’s approach is by far the most comprehensive because it includes not just SDLC activities, but also governance and operations management.&#160; This paper is well worth taking a few minutes to read.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>Public Sector on Demand Launched</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/public-sector-on-demand-launched</link>
      <pubDate>Thu, 02 Apr 2009 12:39:32 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2009/04/02/public-sector-on-demand-launched/</guid>
      <description><![CDATA[Yesterday our team launched Public Sector on Demand.&#160; It is an exciting new subscription-based...]]></description>
      <content:encoded><![CDATA[<p>Yesterday our team launched <a href="https://www.publicsectorondemand.com/">Public Sector on Demand</a>.&#160; It is an exciting new subscription-based SaaS offering with (initially) six applications ranging from public records tracking to case management and student information systems.&#160; This is an important milestone because it is our launch of hosted vertical industry solutions for government and education customers.&#160; Public Sector on Demand offers a new alternative to traditional on premise solutions.&#160; Customers can find the right solution for their needs and get up and running immediately.&#160; This approach drastically lowers the barriers to getting started and will enable our Public Sector focused solutions to reach many new customers.&#160; </p>  <p>The initial solution offerings are:</p>  <ul>   <li><b><a href="https://www.publicrecordstracker.com/">Public Records Tracker</a>. </b>Public Records Tracker organizes and automates the public records request process for state, local and federal government organizations that must respond to Public Records Act and Freedom of Information Act requests.</li>    <li><b><a href="https://www.fasttrackgov.com/">FastTrackGov Citizen Service Solutions.</a> </b>FastTrackGov<b><i> </i></b>is a hosted subscription-based system that provides a full suite of automated community development applications for licensing, permitting, code enforcement and inspection management. </li>    <li><b><a href="https://www.govserver.com/Solutions/Pages/HostedAgendaBuilder.aspx">Agenda Builder.</a> </b>The Agenda Builder on-demand solution provides organizations with electronic review and approval capability for agenda items, resulting in significant time and paper savings. </li>    <li><b><a href="https://www.govserver.com/Solutions/Pages/HostedConstituentManager.aspx">Constituent Manager</a>. </b>The Constituent Manager on-demand solution provides elected officials and their staffs with case management tools that facilitate timely responses to constituent requests. </li>    <li><b><a href="https://www.govserver.com/Solutions/Pages/HostedFieldInspector.aspx">Inspection Manager.</a> </b>The Inspection Manager on-demand offering provides organizations with a Web-based case management solution that gives field inspectors and inside office staff the tools needed to schedule and perform field inspections and manage the abatement process when violations are found and citations are issued. </li>    <li><b><a href="https://backpacksis.com/">Backpack 2008 Student Information System (SIS).</a></b> Backpack is the first on-demand social student information system of its kind, designed to revolutionize SIS technology and provide the ability to centrally manage all aspects of an entire school district. </li> </ul>  <p>In addition to these solutions we established a community engagement site called <a href="https://www.publicsectorondemand.com/">Public Sector Idea Bank</a>.&#160; Public Sector Idea Bank was developed by <a href="https://www.neighborhoodamerica.com/">Neighborhood America</a>.&#160; Neighborhood America has over ten years experience developing award-winning social networking solutions for government and industry.&#160; Idea Bank provides a central place for Microsoft, customers and partners to collaborate around these solutions, collect feedback, and create new ideas for future on demand solutions.&#160; </p>  <p>Congratulations to Carmel Hinkle, Amir Capriles, Scott Mannina on our US Public Sector Business Solutions Team.&#160; These guys put in a tremendous amount of great work over many months to get this launched.&#160; Also a big &quot;Thank-You&quot; to our partners, Eskel Porter Consulting Inc., Mitchell Humphrey, Information Strategies Inc., Metaphor Software, and Neighborhood America all of whom worked very diligently to deliver their excellent solutions. </p>]]></content:encoded>
    </item>
    <item>
      <title>Dynamics CRM 4.0 SDK Update 4.0.6</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/dynamics-crm-4-0-sdk-update-4-0-6</link>
      <pubDate>Sat, 06 Sep 2008 18:20:54 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2008/09/06/dynamics-crm-4-0-sdk-update-4-0-6/</guid>
      <description><![CDATA[A new version of the CRM 4.0 SDK was released on 8/29/2008.&#160; You can get this newest version...]]></description>
      <content:encoded><![CDATA[<p>A new version of the CRM 4.0 SDK was released on 8/29/2008.&#160; You can get this newest version here:&#160; <a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=82e632a7-faf9-41e0-8ec1-a2662aae9dfb&amp;displaylang=en">CRM 4.0.6 SDK</a>.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>Search CRM Blogs with Microsoft Live Search</title>
      <link>https://docs.microsoft.com/archive/blogs/dmcdonald/search-crm-blogs-with-microsoft-live-search</link>
      <pubDate>Mon, 17 Sep 2007 18:11:46 GMT</pubDate>
      <dc:creator><![CDATA[David McDonald]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dmcdonald/2007/09/17/search-crm-blogs-with-microsoft-live-search/</guid>
      <description><![CDATA[This afternoon I was playing around with the new Live Search macros.&nbsp; For a while I...]]></description>
      <content:encoded><![CDATA[<p>This afternoon I was playing around with the new Live Search macros.&nbsp; For a while I have&nbsp;wanted a simple way for a limited scope search against all MSCRM feeds.&nbsp; The Live Search team has a&nbsp;very cool macro capability that makes this&nbsp;easy.&nbsp;&nbsp;Please try out my <a href="https://search.live.com/macros/davidmcd/crmblogsearch/?FORM=OIJG" target="_blank">Dynamics CRM Blog Search page</a>&nbsp;- if you are a Dynamics CRM geek like me then I think that you will want to bookmark this and use it frequently.&nbsp; </p> <p>It uses a new macro feature of Live Search to scope your search down to only MSCRM blogs.&nbsp; It is especially cool that you can add this search to your browser search box.&nbsp; </p> <p>And if you don't like mine, you can create your own!&nbsp; If you create your own MSCRM macro, please comment on this post to share it with me and the rest of the community.&nbsp; </p>]]></content:encoded>
    </item>
  </channel>
</rss>