<?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>MSCRM Blogger &#187; Microsoft</title>
	<atom:link href="http://mscrmblogger.com/tag/microsoft/feed/" rel="self" type="application/rss+xml" />
	<link>http://mscrmblogger.com</link>
	<description>Achieving it all with Microsoft Dynamics CRM™</description>
	<lastBuildDate>Thu, 10 May 2012 20:24:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CRM2011: Attachment Image Browser HTML Web Resource</title>
		<link>http://mscrmblogger.com/2012/03/31/imagebrowser-webresource/</link>
		<comments>http://mscrmblogger.com/2012/03/31/imagebrowser-webresource/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 03:59:32 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[crm2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=986</guid>
		<description><![CDATA[If you need to be able to view the images attached to a CRM entity, this web resource (and solution) will help.  A managed and unmanaged solution that uses the base64 encoded pictures for immediate rendering.]]></description>
			<content:encoded><![CDATA[<p>Ok, a lot of people have been asking on the forums about how to display images that are attached to your CRM entity.  To help with that, here is a web-resource that will display images and fit them to the area allotted.  If you have more than 1 picture it will show some previous and next buttons below the photo.  The general idea here is to not only display an image on the form, but work across multiple browsers (and systems).  Leveraging JQuery and the REST SDK, this attachment image web-resource is a quick-and-easy image control, granted it doesn&#8217;t include all of the features the Silverlight CRMAttachmentImage control does.</p>
<p>Below you can see an example of what it looks like.  YOu can download the <a href='http://mscrmblogger.com/wp-content/uploads/2012/03/ImageBrowser_1_0_managed.zip'>managed solution here</a> and the <a href='http://mscrmblogger.com/wp-content/uploads/2012/03/ImageBrowser_1_0.zip'>unmanaged solution here</a>.</p>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2012/03/040112_0359_CRM2011Atta1.png" alt=""/>
	</p>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2012/03/040112_0359_CRM2011Atta2.png" alt=""/></p>
<p>You can specify the height and width in the parameters.</p>
<p><code>height:200|width:100</code></p>
<p>The image will resize to scale.</p>
<pre name="code" class="html">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
  &lt;title&gt;Image Browser&lt;/title&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;jq_1.7.2.min.js&quot;&gt;
&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
    $.fn.sandbox = function(fn) {
        var element = $(this).clone(), result;
        // make the element take space in the page but invisible
        element.css({visibility: 'hidden', display: 'block'}).insertAfter(this);
        // to override any display: none !important you may have been using
        element.attr('style', element.attr('style').replace('block', 'block !important'));
        result = fn.apply(element);
        element.remove();
        return result;
    };

    var GetDataParams = function()
    { //modified version of: http://technet.microsoft.com/en-us/library/gg327945.aspx
      //Get the any query string parameters and load them
      //into the vals array

      var vals = new Array();
      if (location.search != &quot;&quot;)
      {
        vals = location.search.substr(1).split(&quot;&amp;&quot;);
        for (var i in vals)
        {
          vals[i] = vals[i].replace(/\+/g, &quot; &quot;).split(&quot;=&quot;);
        }

        //look for the parameter named 'data'
        var found = false;
        for (var i in vals)
        {
          if (vals[i][0].toLowerCase() == &quot;data&quot;)
          {
            found = true;
            var datavals = decodeURIComponent(vals[i][1]).split(&quot;|&quot;);
            for (var i in datavals)
            {
              datavals[i] = datavals[i].replace(/\+/g, &quot; &quot;).split(&quot;=&quot;);
            }
            break;
          }
        }
        if (found) { return datavals; }
      }
      return null;
    }

    var ImageBrowser = function () {
      function getImage() {
        function getRecords(query, successCallback) {
            $.ajax({
                type: &quot;GET&quot;,
                async: true,
                contentType: &quot;application/json; charset=utf-8&quot;,
                url: query,
                datatype: &quot;json&quot;,
                beforeSend: function (request) {

                    request.setRequestHeader(&quot;Accept&quot;, &quot;application/json&quot;);
                },
                success: function(data, textStatus, xhr) {
                    if (data &amp;&amp; data.d &amp;&amp; data.d.results) {
                        successCallback(data.d.results)
                    }
                },
                error: function (xhr, textStatus, errorThrown) {
                    alert(&quot;Error : &quot; +
                        xhr.status + &quot;: &quot; +
                        xhr.statusText);
                }
            });
        }

        function buildQuery(s,c,f,t,p) {
            function getServerUrl() {  // From CrmRestKit.js
                var localServerUrl = window.location.protocol + &quot;//&quot; + window.location.host;
                var context = parent.Xrm.Page.context;

                if (context.isOutlookClient() &amp;&amp; !context.isOutlookOnline()) {
                    return localServerUrl;
                }
                else {
                    var crmServerUrl = context.getServerUrl();
                    crmServerUrl = crmServerUrl.replace(/^(http|https):\/\/([_a-zA-Z0-9\-\.]+)(:([0-9]{1,5}))?/, localServerUrl);
                    crmServerUrl = crmServerUrl.replace(/\/$/, &quot;&quot;);
                }
                return crmServerUrl;
            }
            return getServerUrl() + &quot;/XRMServices/2011/OrganizationData.svc/&quot; + s + &quot;/?&quot; +
                &quot;&amp;$filter=&quot; + f +
                &quot;&amp;$select=&quot; + c.join(',') +
                &quot;&amp;$top=&quot; + t +
                &quot;&amp;$skip=&quot; + p;
        }

        function updateImage(records) {
            var foundpicture = false;
            var picture;
            if (records.length&lt;1) {
                $(&quot;#picture&quot;).css(&quot;display&quot;,&quot;none&quot;);
                picture = $(&quot;#nopicture&quot;);
                picture.css(&quot;height&quot;,200);
                picture.css(&quot;width&quot;,120);
            } else {
                foundpicture = true;
                var source = &quot;data:&quot; + records[0].MimeType + &quot;;base64,&quot; + records[0].DocumentBody;
                picture = $(&quot;#picture&quot;);
                picture.css(&quot;height&quot;,&quot;auto&quot;);
                picture.css(&quot;width&quot;,&quot;auto&quot;);
            }

            picture.css(&quot;display&quot;,&quot;none&quot;);

            var pHeight = ImageBrowser.MaxHeight;
            var pWidth = ImageBrowser.MaxWidth;

            if (foundpicture) { picture.attr(&quot;src&quot;,source); }

            var pictureSize = picture.sandbox(function(){ return {height: this.height(), width: this.width()}; });

            var scale = 1;
            if (pictureSize.height&gt;pHeight) {
                if ((pictureSize.width-pWidth)&gt;(pictureSize.height-pHeight)) {
                    scale = pictureSize.width / pWidth;
                } else {
                    scale = pictureSize.height / pHeight;
                }
            }
            if (scale!=1) {
                var nh = pictureSize.height / scale;
                var nw = pictureSize.width / scale;

                picture.css(&quot;height&quot;,nh + &quot;px&quot;);
                picture.css(&quot;width&quot;,nw + &quot;px&quot;);
            }

            picture.css(&quot;display&quot;,&quot;block&quot;);
        }

        function updateFirstLast(records) {
            ImageBrowser.First = (ImageBrowser.Index==0) ? true : false;
            ImageBrowser.Last = (records.length&lt;1) ? true : false;

            $(&quot;#previous&quot;).css(&quot;display&quot;,ImageBrowser.First ? &quot;none&quot; : &quot;inline&quot;);
            $(&quot;#next&quot;).css(&quot;display&quot;,ImageBrowser.Last ? &quot;none&quot; : &quot;inline&quot;);
        }

        var setName = 'AnnotationSet';
        var columns = ['DocumentBody','MimeType'];

        var filter = &quot;ObjectId/Id eq (guid'&quot; + ImageBrowser.EntityId + &quot;') &quot; +
                     &quot;and startswith(MimeType,'image/') &quot; +
                     &quot;and ObjectTypeCode eq '&quot; + ImageBrowser.EntityName + &quot;'&quot;;

        var top = 1;
        var skip = ImageBrowser.Index;

        getRecords(buildQuery(setName,columns,filter,top,skip+1),updateFirstLast);
        getRecords(buildQuery(setName,columns,filter,top,skip),updateImage);
      }

      function previous() {
        if (ImageBrowser.Index&gt;0) {
            ImageBrowser.Index = ImageBrowser.Index - 1;
            getImage();
        }
      }

      function next() {
        if (ImageBrowser.Last==false) {
            ImageBrowser.Index = ImageBrowser.Index + 1;
            getImage();
        }
      }

      function init() {
        ImageBrowser.MaxWidth = $(&quot;body&quot;).width();
        ImageBrowser.MaxHeight = $(&quot;body&quot;).height();
        var data = GetDataParams();

        for (var i in data)
        {
            switch (data[i][0].toLowerCase())
            {
                case 'height':
                    var h = parseInt(data[i][1]);
                    var ph = $(&quot;body&quot;).height();
                    if (h&lt;ph) {
                        ImageBrowser.MaxHeight = h;
                    } else {
                        ImageBrowser.MaxHeight = ph;
                    }
                    break;

                case 'width':
                    var w = parseInt(data[i][1]);
                    var pw = $(&quot;body&quot;).width();
                    if (w&lt;pw) {
                        ImageBrowser.MaxWidth = w;
                    } else {
                        ImageBrowser.MaxWidth = pw;
                    }
                    break;

                $(&quot;#area&quot;).height(parseInt(data[i][1])); break;
            }
        }
        getImage();
      }

      return {
            EntityId: parent.Xrm.Page.data.entity.getId(),
            EntityName: parent.Xrm.Page.data.entity.getEntityName(),
            First: true,
            MaxHeight: 0,
            MaxWidth: 0,
            Last: false,
            Index: 0,
            Previous: previous,
            Next: next,
            Initialize: init
      };
    }();

  function next() { ImageBrowser.Next(); }
  function prev() { ImageBrowser.Previous(); }
  function onload() {ImageBrowser.Initialize(); }

  //]]&gt;
  &lt;/script&gt;
  &lt;style type=&quot;text/css&quot;&gt;
/*&lt;![CDATA[*/
  html, body, div {
    background-color: rgb(246, 248, 250);
    font-family: &quot;Tahoma&quot;, &quot;Helvetica&quot;, &quot;Arial&quot;,  &quot;Verdana&quot;, &quot;sans-serif&quot;;
    font-size:9px;
    padding: 0px;
    margin: 0px;
  }
  body {
    margin: 3px;
  }
  body, div.area {
    text-align: center;
  }
  img {
    border-style: none;
  }
  #nopicture {
    border: solid 1px black;
    font-size: 9px;
    text-align:center;
  }
  #nopicture p {
    padding-top: 30%;
  }
  /*]]&gt;*/
  &lt;/style&gt;
  &lt;meta charset=&quot;utf-8&quot; /&gt;
&lt;/head&gt;

&lt;body onload=&quot;onload();&quot; contenteditable=&quot;true&quot;&gt;
  &lt;div id=&quot;area&quot;&gt;
  &lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tr&gt;&lt;td id=&quot;picturearea&quot; colspan=&quot;2&quot;&gt;&lt;img id=&quot;picture&quot; class=&quot;picture&quot; src=&quot;&quot; /&gt;&lt;div id=&quot;nopicture&quot; style=&quot;display:none;&quot;&gt;&lt;p&gt;No Pictures&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;
    &lt;td style=&quot;text-align:right;&quot;&gt;&lt;a id=&quot;previous&quot; href=&quot;javascript:prev();&quot; style=&quot;display:none&quot;&gt;&lt;img src=&quot;img_icons/previous.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;
    &lt;td style=&quot;text-align:left;&quot;&gt;&lt;a id=&quot;next&quot; href=&quot;javascript:next();&quot; style=&quot;display:none&quot;&gt;&lt;img src=&quot;img_icons/next.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Thanks to <a href="http://wvega.com/246/get-height-of-a-hidden-element-using-jquery/" target="_blank">Willington&#8217;s Blog</a> for the sandbox jquery function.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2012/03/31/imagebrowser-webresource/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>InfoPath to CRM: Accepting Emailed InfoPath Forms</title>
		<link>http://mscrmblogger.com/2011/11/21/infopath-to-crm-accepting-emailed-infopath-forms/</link>
		<comments>http://mscrmblogger.com/2011/11/21/infopath-to-crm-accepting-emailed-infopath-forms/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 19:05:51 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[contact]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[InfoPath]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=889</guid>
		<description><![CDATA[Everybody loves to use InfoPath forms.  And let's face it, we all wish we could just take them and put them into CRM.  This post delves into how I integrated InfoPath &#38; CRM to dynamically allow InfoPath forms received by email into CRM records.  It is still <i>under development</i>, but the source code has been partially tested and works.]]></description>
			<content:encoded><![CDATA[<p>Everybody loves to use InfoPath forms.  And let&#8217;s face it, we all wish we could just take them and put them into CRM.  What I&#8217;ve written is a simple way to do that without the hassle of figuring out how to bind the InfoPath form schema to a custom WCF service.  It still doesn&#8217;t do everything I want it to, but it works, so I figured I&#8217;d go ahead and put it out there for everyone to look at, play with, and even use.</p>
<p>If you are interested in this solution, you can download the following:</p>
<ul>
<li><a href='http://mscrmblogger.com/wp-content/uploads/2011/11/InfoPath_1_0_0_0_managed.zip'>Managed Solution</a> (this is the only thing you need)</li>
<li><a href='http://mscrmblogger.com/wp-content/uploads/2011/11/InfoPath_1_0_0_0.zip'>Unmanaged Solution</a> (in case you want to modify mine, like add grid support, it is on my to-do list)</li>
<li><a href='http://mscrmblogger.com/wp-content/uploads/2011/11/InfoPath4CRMSourceCode.zip'>Source Code</a> (this is in case you would prefer to use a WCF service or if you just want to play around with my code)</li>
</ul>
<p>Once you&#8217;ve installed the managed solution, you&#8217;ll need to do the following to create / setup an InfoPath form:</p>
<ol>
<li>
<p>For this particular InfoPath integration, you need to create InfoPath Forms that mirror a CRM Entity.<br />
<strong>Note: </strong><em>You can always create a new entity for the form data.</em></p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC13.png" alt=""/></p>
</li>
<li>
<p>Rename the default form Group to the name of the entity (ex: Contact)</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC23.png" alt=""/></p>
</li>
<li>
<p>Inside CRM create the InfoPath form (it is an entity included in the solution), select the entity and save the form.
</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC31.png" alt=""/></p>
</li>
<li>
<p>Once it has been saved, you can copy the ID using the &#8220;Copy ID&#8221; link in the header.<br />
<br /><strong>Note: </strong>If you do not select the <em>Allow Any CRM Field </em>checkbox, you will need to add the individual Fields, which can be found in the left navigation.</p>
</li>
<li>
<p>In the InfoPath Form Designer, add a field named SubmissionCode with the Default Value as the ID you just copied.<br />
<br /><b>Note:</b> Using the submission code allows us to check and see if the form is valid, active, and allowed.</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/submissioncode.png" alt=""/></p>
</li>
<li>
<p>Add a field for each of the fields in CRM that you want to be available, selecting the appropriate data type.<br />
<br /><b>Note:</b> Unfortunately I have not had the time to test the fields and have been using the checkbox on the infopath form record to enable any/all CRM fields.  However, I did not want to delay releasing the code and information as it currently is.  If someone identifies a problem with this or any other section of the code, I&#8217;ll be happy to look into it and work on resolving the issue.</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC53.png" alt=""/></p>
</li>
<li>
<p>Layout the fields on the form, then click File &gt; Submit Options &gt; To Email</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC63.png" alt=""/></p>
</li>
<li>
<p>Enter the Queue email or where you want new forms to be submitted.</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC73.png" alt=""/></p>
</li>
<li>
<p>Click Next.</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC83.png" alt=""/></p>
</li>
<li>
<p>Click Finish.</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC93.png" alt=""/></p>
</li>
<li>Save and close the form designer.</li>
<li>
<p>Open the form and test submission.</p>
<p style="text-align: center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC103.png" alt=""/></p>
</li>
</ol>
<p>Once the email comes into CRM, the process of reading the form is easy; you just open it up and click the <img src="http://mscrmblogger.com/wp-content/uploads/2011/11/112111_1905_InfoPathtoC113.png" alt=""/> Import InfoPath button on the ribbon.</p>
<p>Usually I would post the source-code and comment on how it works in great detail, but this time, it really depends on which component.  There is a plugin and WCF service written in C# as well as two Jscript files, one for the buttons and one for the InfoPath form inside CRM that creates a drop-down of the entities in CRM.  I would suggest downloading the unmanaged solution and source-code if you want to delve into those items.</p>
<p>Now, for complex situations or form conversions, binding the InfoPath schema is the way to go.  Using that method (the one described in detail on <a href="http://blogs.msdn.com/b/philoj/archive/2005/11/08/490200.aspx">Philo&#8217;s Weblog</a>) you can import the InfoPath form schema into Visual Studio:</p>
<ol>
<li>Create an InfoPath form and lay it out the way you want it.
</li>
<li>Extract the form files (File | Extract Form Files) to a location you can find later.
</li>
<li>Close the InfoPath form designer.
</li>
<li>Open the Visual Studio command prompt.
</li>
<li>Change to the directory where you extracted the files<br /><strong>cd c:\myinfopathfiles<br />
</strong></li>
<li>Run xsd against the myschema.xsd in that directory, and specify the namespace you would like to use.<br /><strong>Note: </strong>My WCF namespace is CrmInfoPathService and my plugin namespace is InfoPathPlugin.<br /><strong>xsd.exe myschema.xsd /classes /l:cs /n:InfoPathPlugin<br />
</strong></li>
<li>Then you can deserialize the xml into the object and store it in CRM or any other system using the logic embedded in your code.</li>
</ol>
<p>The key point to my solution was not to do something that everyone does on occasion, but to make something so that I can leverage it in the future and not have to create a new integration every time I wanted to leverage a new form.  Now, on that note, here are the list of things that if you delve into, I&#8217;d like to know, a.k.a. my to-do list for this project:
</p>
<ul>
<li>Add a button onto the grid for activities</li>
<li>Create a way to handle child entities.</li>
<li>Modify the plugin/WCF code to link the created entities to the form email using connections.</li>
<li>Change the button on the form to monitor for the results (success/failure) and report back to the user.</li>
<li><i>Any great ideas my readers think should be added!</i></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/11/21/infopath-to-crm-accepting-emailed-infopath-forms/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Changing OptionSet Values on Yes/No Form Field Change</title>
		<link>http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/</link>
		<comments>http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 16:17:12 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[boolean]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[CRM Online]]></category>
		<category><![CDATA[crm2011]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[picklist]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=870</guid>
		<description><![CDATA[<p>Recently someone posted a question about the article I had written for CRM 4 as an example.  Here is the 2011 version to hopefully help people find the proper information.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve received some questions on how to change the optionset (previously called picklist) values in CRM 2011 the same way I did in my <a href="http://mscrmblogger.com/2009/10/03/changing-picklist-values-on-yesno-form-field-change/">previous CRM 4 post</a> about using the OnChange event of a yes/no field to change the values of a picklist.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/gg334266.aspx">This technet page shows the methods available for the different types of controls.</a></p>
<p><strong>Here is an example of how to change the optionset based on a yes/no field:</strong></p>
<pre name="code" class="javascript">
function BuildOptionSet(picklist, valuelist)
{
	picklist.clearOptions();
	for(var i=0; i&lt;valuelist.length; i++)
	{
		var listitem = valuelist[i];
		picklist.addOption(listitem[0], listitem[1]);
	}
}

var lista = new Array();
lista[0] = new Array('Alpha',0);
lista[1] = new Array('Beta',1);

var listb = new Array();
listb[0] = new Array('Charlie',2);
listb[1] = new Array('Delta',3);

var uselista = Xrm.Page.data.entity.attributes.get("YesNo").getValue();
var optionset = Xrm.Page.ui.controls.get("OptionSet");

if (uselista==true) {
   BuildOptionSet(optionset, lista);
} else {
   BuildOptionSet(optionset, listb);
}
</pre>
<p>You just need to change the values of lista and listb and the YesNo and OptionSet lines to reflect the fields on your form, and add it to the onchange event of the dropdown Yes/No form field.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRM 2011: Slider Form Control Web Resource</title>
		<link>http://mscrmblogger.com/2011/10/04/crmslider/</link>
		<comments>http://mscrmblogger.com/2011/10/04/crmslider/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 20:23:11 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[General API Usage]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[CRM Online]]></category>
		<category><![CDATA[crm2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[slidebar]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=804</guid>
		<description><![CDATA[Here is another web-resource html control to expand your CRM forms.  It is a slider control for CRM with step control.  It provides a graphical way to slide a value up and down.]]></description>
			<content:encoded><![CDATA[<p>Here is another web-resource html control to expand your CRM forms.  It is a slider control for CRM with step control.</p>
<p>Below is an example of the slider control in action, and you can <a href='http://mscrmblogger.com/wp-content/uploads/2011/10/SliderFormControl_1_0_managed.zip'>click here to download a solution</a> to import the web-resources into your CRM deployment (it is a managed solution with no entities, just like the <a href="http://mscrmblogger.com/2011/09/20/crm-2011-star-rating-control/" target="_blank">star rating control</a>).  If you want the unmanaged solution you can download it <a href='http://mscrmblogger.com/wp-content/uploads/2011/10/SliderFormControl_1_0.zip'>here</a>.</p>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/10/slider2.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/10/slider2.png" alt="" title="Slider Form Control" width="816" height="360" class="aligncenter size-full wp-image-806" /></a></p>
<p>Ok, once you have the web-resource loaded into your CRM deployment, you&#8217;ll need to create a new field to store the slider value and put it on the form, but uncheck the visible box.</p>
<p>Add the Web-Resource to the form, check the box to <strong>display the label on the form</strong>, and then enter your parameters.  I like using a pipe separator.  The available parameters are:</p>
<ul>
<li><strong>min</strong>: minimum value</li>
<li><strong>max</strong>: maximum value</li>
<li><strong>field</strong>: the CRM field to store the value in</li>
<li><strong>step</strong>: the step increase</li>
<li><strong>stepoverride</strong>: don&#8217;t use the step when a value is manually entered</li>
</ul>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/10/Slider_Score_Resource1.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/10/Slider_Score_Resource1.png" alt="" title="Slider_Score_Resource1" width="486" height="615" class="aligncenter size-full wp-image-825" /></a></p>
<p>Make sure to click on the formatting tab and set the <strong>number of rows to 1</strong>, <strong>scrolling to Never</strong>, and uncheck the box to <strong>display the border</strong>.</p>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/10/Slider_Score_Resource2.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/10/Slider_Score_Resource2.png" alt="" title="Slider_Score_Resource2" width="486" height="622" class="aligncenter size-full wp-image-826" /></a></p>
<p>Then move the hidden field down and out the way.  If you have a lot of fields you are accessing through form scripts you could just drop them into a hidden section.</p>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/10/Score-Field.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/10/Score-Field.png" alt="" title="Score Field" width="544" height="251" class="aligncenter size-full wp-image-828" /></a></p>
<p>Here is the code for the slider control HTML web resource.</p>
<pre name="code" class="html">
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Slider Control&lt;/title&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
var Settings = {};
Settings.Min = 0;
Settings.Max = 100;
Settings.Step = 5;
Settings.Value = 50;
Settings.Field = null;
Settings.AllowStepOverride = false;

var Slider = {};
Slider.Drag = false;

Slider.Initialize = function Slider(id,min,max,step,value,onchange) {
  Settings.Min = min;
  Settings.Max = max;
  Settings.Step = step;
  Slider.Value = value;

  var ihtml = &quot;&quot;;
  ihtml += &quot;&lt;table width='100%' cellspacing='0' cellpadding='0'&gt;&lt;tr&gt;&quot;;
  ihtml += &quot;&lt;td class='left-bracket'&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='value'&gt;&quot;;
  ihtml += &quot;&lt;input class='value' id='value' type='text' onchange='Slider.SetValue();' /&gt;&quot;;
  ihtml += &quot;&lt;/td&gt;&lt;td class='right-bracket'&gt;&amp;nbsp;&lt;/td&gt;&quot;;
  ihtml += &quot;&lt;td class='slider-left' /&gt;&lt;td class='slider-area' id='&quot;+id+&quot;-area' &gt;&quot;;
  ihtml += &quot;&lt;div id='&quot;+id+&quot;-selector' class='slider-selector' /&gt;&lt;/td&gt;&quot;
  ihtml += &quot;&lt;td class=&#39;slider-right&#39; /&gt;&lt;/tr&gt;&lt;/td&gt;&lt;/table&gt;&quot;;
  var p = document.getElementById(id);
  p.innerHTML = ihtml;

  Slider.Element = document.getElementById(id+&quot;-area&quot;);
  Slider.Element.attachEvent(&quot;onmousedown&quot;,Slider.OnMouseClick);

  Slider.Id = id;
  Slider.Selector = document.getElementById(id+&quot;-selector&quot;);
  Slider.Selector.attachEvent(&quot;onmousedown&quot;,Slider.OnMouseDown);
  Slider.Selector.attachEvent(&quot;onmousemove&quot;,Slider.OnMouseMove);
  Slider.Selector.attachEvent(&quot;onmouseup&quot;,Slider.OnMouseUp);
  Slider.Selector.attachEvent(&quot;onmouseleave&quot;,Slider.OnMouseUp);

  Slider.UpdatePosition();
}

Slider.SliderRatio = function() {
  var num =  Settings.Max - Settings.Min;
  var den = parseFloat(Slider.Element.offsetWidth)-parseFloat(Slider.Selector.offsetWidth);
  return den/num;
};

Slider.UpdatePosition = function () {
  Slider.Position = Math.round(Slider.Value*Slider.SliderRatio());
  Slider.SetPosition();
};

Slider.OnMouseClick = function(e) {
  Slider.Position = e.clientX - (8+Slider.Selector.offsetLeft-parseInt(Slider.Selector.style.left.replace(&quot;px&quot;,&quot;&quot;)));
  Slider.SetPosition();
  Slider.OnChange(Slider.Value);
}

Slider.SetPosition = function() {
  if (Slider.Position&lt;0) Slider.Position = 0;
  var max = Slider.Element.offsetWidth-Slider.Selector.offsetWidth;
  if (Slider.Position&gt;max) Slider.Position = max;

  Slider.Selector.style.left = Slider.Position + &quot;px&quot;;

  var i = Math.round(Slider.Position/Slider.SliderRatio()) + Settings.Min;
  i = (Math.floor(i/Settings.Step))*Settings.Step;

  Slider.Value = i;

  var val = document.getElementById('value');
  if (val===null) return;
  val.value = i;
}

Slider.SetValue = function() {
  var val = document.getElementById('value');
  if (Settings.AllowStepOverride) {
    Slider.Value = val.value;
  } else {
    Slider.Value = Math.round(val.value/Settings.Step)*Settings.Step;
  }
  if (Slider.Value&lt;Settings.Min) Slider.Value = Settings.Min;
  if (Slider.Value&gt;Settings.Max) Slider.Value = Settings.Max;
  Slider.UpdatePosition();
}

Slider.OnMouseDown = function(e)  {
  Slider.Drag = true;
}

Slider.OnMouseMove = function(e) {
  if (Slider.Drag) {
    Slider.Position = e.clientX - (8+Slider.Selector.offsetLeft-parseInt(Slider.Selector.style.left.replace(&quot;px&quot;,&quot;&quot;)));
    Slider.SetPosition();
  }
};

Slider.OnMouseUp = function(e) {
  if (Slider.Drag) {
    Slider.Drag = false;
    Slider.OnChange(Slider.Value);
  }
};

Slider.OnChange = function(val) {
  parent.Xrm.Page.data.entity.attributes.get(Settings.Field).setValue(val);
};

var InitializeSlider = function() {
  var data = WebResource.GetDataParams();
  var sliderBox = document.getElementById(&quot;sliderBox&quot;);

  for (var i in data)
  {
    switch (data[i][0].toLowerCase())
	{
	  case 'min': Settings.Min = parseInt(data[i][1],10); break;
	  case 'max': Settings.Max = parseInt(data[i][1],10); break;
	  case 'step': Settings.Step = parseInt(data[i][1],10); break;
	  case 'value': Settings.Value = parseInt(data[i][1],10); break;
	  case 'field': Settings.Field = data[i][1]; break;
	  case 'stepoverride': Settings.AllowStepOverride = (data[i][1]=='true'); break;
	  default:break;
	}
  }

  Slider.Initialize(&quot;slider&quot;,Settings.Min,Settings.Max,Settings.Step,Settings.Value,null)

  if (Settings.Field!=null) {
    var val = parent.Xrm.Page.data.entity.attributes.get(Settings.Field).getValue();
	if (val!==null) {
	  var num = parseInt(val);
	  Slider.Value = num;
	  Slider.UpdatePosition();
	}
  }
};

var WebResource = {};

WebResource.GetDataParams = function()
{ //modified version of: http://technet.microsoft.com/en-us/library/gg327945.aspx
  //Get the any query string parameters and load them
  //into the vals array

  var vals = new Array();
  if (location.search !== &quot;&quot;)
  {
    vals = location.search.substr(1).split(&quot;&amp;&quot;);
    for (var i in vals)
    {
      vals[i] = vals[i].replace(/\+/g, &quot; &quot;).split(&quot;=&quot;);
    }

    //look for the parameter named 'data'
    var found = false;
        var datavals;
    for (var j in vals)
    {
      if (vals[j][0].toLowerCase() == &quot;data&quot;)
      {
        found = true;
        datavals = decodeURIComponent(vals[j][1]).split(&quot;|&quot;);
        for (var k in datavals)
        {
          datavals[k] = datavals[k].replace(/\+/g, &quot; &quot;).split(&quot;=&quot;);
        }
        break;
      }
    }
    if (found) { return datavals; }
  }
  return null;
};
  &lt;/script&gt;
  &lt;style type=&quot;text/css&quot;&gt;
html, body {
  padding: 0px;
  margin: 0px;
  border: 0px;
  background-color: rgb(246, 248, 250);
  overflow:hidden;
}
.slider-left, .slider-area, .slider-right {
  background-image:url(img/bar.png);
  background-repeat:repeat-x;
  height:17px;
  padding:0px;
  margin:0px;
  cursor:hand;
}
.slider-left, .slider-right {
  width: 7px;
}
div.slider-selector {
  background-image:url(img/selector.png);
  background-repeat:no-repeat;
  width:15px;
  height:17px;
  position: relative;
  cursor:hand;
}
td.left-bracket, td.right-bracket {
  background-repeat:no-repeat;
  height:17px;
  width:6px;
  display:inline;
}
td.left-bracket {
  background-image:url(img/left_bracket.png);

}
td.right-bracket {
  background-image:url(img/right_bracket.png);
}
td.value {
  background-image:url(img/val_bk.png);
  background-repeat:repeat-x;
  height:17px;
  width:30px;
}
input.value {
  border: none;
  font:11px segoe ui,tahoma,arial;
  height:17px;
  width:30px;
  background-color:transparent;
  vertical-align:top;
  padding-top:1px;
  text-align:center;
}
  &lt;/style&gt;
&lt;/head&gt;
&lt;body onload=&quot;InitializeSlider();&quot;&gt;
&lt;div id=&quot;slider&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Thanks to <a href="http://manishmistry.wordpress.com" target="_blank">Manish Mistry</a> comment on my star control for refreshing the iframe when you change the value, you could do the same on this control.  However, you could also just set the value and update the position. The only reason I get the control&#8217;s object and it&#8217;s id is because I&#8217;m not 100% sure the id will always match, even though all my tests indicate it does.</p>
<pre name="code" class="javascript">
var control = Xrm.Page.ui.controls.get('WebResource_Score');
var id      = control.getObject().id;
var frame   = document.frames[id];
frame.Slider.Value = 50;
frame.Slider.UpdatePosition();
</pre>
<p>One of my TODO&#8217;s is to join my web resources HTML form controls into a single library once I have enough of them so that people can leverage them in an easier manner.  If anyone has any ideas for custom controls for Dynamics CRM, let me know and I&#8217;ll see if I can build it.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/10/04/crmslider/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CRM 2011: Star Rating Form Control</title>
		<link>http://mscrmblogger.com/2011/09/20/crm-2011-star-rating-control/</link>
		<comments>http://mscrmblogger.com/2011/09/20/crm-2011-star-rating-control/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 02:06:14 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[General API Usage]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Scoperta]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[rating]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/2011/09/20/crm-2011-star-rating-control/</guid>
		<description><![CDATA[<p>Another HTML control example that adds a star rating form control to CRM 2011 as a web-resource.  It includes a managed solution that you can download and install as well as the source and all images used in creating the solution.</p>]]></description>
			<content:encoded><![CDATA[<p>To expand on the technique used for my previous post on <a href="http://mscrmblogger.com/2011/05/11/crm-2011-making-the-state-field-a-drop-down/">making the state field a drop down</a> here is a star rating field control so that you can get a nice visual star rating control that is configurable.</p>
<p>Below is an example of the star rating control in action, and you can <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/RatingControl_1_0_managed.zip'>click here to download a solution</a> to import the web-resources into your CRM deployment (it is a managed solution with no entities).</p>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/092111_0206_CRM2011Star11.png" alt="" class="aligncenter size-full" /></p>
<p>Ok, once you have the web-resource loaded into your CRM deployment, you&#8217;ll need to create a new field to store the rating and put it on the form, but uncheck the visible box.</p>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/092111_0206_CRM2011Star21.png" alt="" class="aligncenter size-full" /></p>
<p>Add the Web-Resource to the form, and check the box to <strong>display the label on the form</strong>.</p>
<p>Then enter your parameters (I like using a pipe as a separator).  The available parameters are:</p>
<ul>
<li><strong>min</strong>: minimum star rating – really should always be 1</li>
<li><strong>max</strong>: maximum star rating – maybe 5 or 10</li>
<li><strong>field</strong>: the CRM field to store the value in</li>
<li><strong>showvalue</strong>: whether or not to display the numerical value</li>
</ul>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/092111_0206_CRM2011Star31.png" alt="" class="aligncenter size-full" /></p>
<p>Make sure to click on the formatting tab and set the <strong>number of rows to 1</strong>, <strong>scrolling to Never</strong>, and check the box to <strong>display the border</strong>.</p>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/092111_0206_CRM2011Star41.png" alt="" class="aligncenter size-full" /></p>
<p>Then move the hidden field down and out the way.  If you have a lot of fields you are accessing through form scripts you could just drop them into a hidden section.</p>
<p><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/092111_0206_CRM2011Star51.png" alt="" class="aligncenter size-full" /></p>
<p>Now that you know how to set it up, let&#8217;s go ahead and look at the code.</p>
<pre name="code" class="html">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
  &lt;title&gt;Rating Control&lt;/title&gt;
  &lt;link href=&quot;/_common/styles/fonts.css.aspx?lcid=1033&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
  &lt;link href=&quot;/_common/styles/global.css.aspx?lcid=1033&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
  &lt;link href=&quot;/_common/styles/select.css.aspx?lcid=1033&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
var Rating = {};

// Default Values
Rating.ShowValue = false;
Rating.Max = 5;
Rating.Min = 1;
Rating.Field = '';
Rating.Value = null;

Rating.Highlight = function(index)
{
  var val = document.getElementById('rating_value');
  if (index===null) {
    index = -1;
    val.innerHTML = '[Not Set]';
  } else {
    val.innerHTML = '['+index+'/'+Rating.Max+']';
  }
  for(var i=Rating.Min; i&lt;=Rating.Max;i++)
  {
    if (i&lt;=index) {
      document.getElementById(&quot;rating_&quot;+i).className = &quot;staron&quot;;
    } else {
      document.getElementById(&quot;rating_&quot;+i).className = &quot;staroff&quot;;
    }
  }
};

Rating.HolderRollover = function() {
  if (Rating.Value !== null) {
    var r = document.getElementById('rating_remove');
    r.className = 'stardel';
  }
};

Rating.HolderRollout = function() {
  var r = document.getElementById('rating_remove');
  r.className = 'stardel2';
};

Rating.Rollover = function(index) {
  Rating.Highlight(index);
};

Rating.Rollout = function()
  {
  Rating.Highlight(Rating.Value);
};

Rating.Set = function(index) {
  Rating.Value = index;
  if (index&lt;0) {
    parent.Xrm.Page.data.entity.attributes.get(Rating.Field).setValue(null);
  } else {
    parent.Xrm.Page.data.entity.attributes.get(Rating.Field).setValue(Rating.Value);
  }
  Rating.Highlight(index);
};

Rating.Initialize = function() {
  var data = WebResource.GetDataParams();
  for (var i in data)
  {
    switch (data[i][0].toLowerCase())
        {
          case 'min': Rating.Min = parseInt(data[i][1],10); break;
          case 'max': Rating.Max = parseInt(data[i][1],10); break;
          case 'field': Rating.Field = data[i][1]; break;
          case 'showvalue': Rating.ShowValue = (data[i][1] == 'true'); break;
          default:break;
        }
  }
  var d = document.getElementById('starholder');
  for (var j=Rating.Min;j&lt;=Rating.Max;j++)
  {
    var el = &quot;&lt;span id='rating_&quot;+j+&quot;' &quot; +
             &quot;onmouseover='Rating.Rollover(&quot;+j+&quot;);' &quot; +
             &quot;onmouseout='Rating.Rollout();' &quot; +
             &quot;onclick='Rating.Set(&quot;+j+&quot;);' /&gt;&quot;;
    d.innerHTML += el;
  }

  var rel = &quot;&lt;span id='rating_remove' class='stardel2' &quot; +
            &quot;onclick='Rating.Set(null);' onmouseover='Rating.Rollover(null);' /&gt;&quot;;
  d.innerHTML += rel;

  var val = &quot;&lt;span id='rating_value' class='value' &quot; +
            (Rating.ShowValue ? &quot;&quot; : &quot;style='display:none' &quot;) +
            &quot;/&gt;&quot;;
  d.innerHTML += val; 

  Rating.Value = parent.Xrm.Page.data.entity.attributes.get(Rating.Field).getValue();
  Rating.Highlight(Rating.Value);
};

var WebResource = {};

WebResource.GetDataParams = function()
{ //modified version of: http://technet.microsoft.com/en-us/library/gg327945.aspx
  //Get the any query string parameters and load them
  //into the vals array

  var vals = new Array();
  if (location.search !== &quot;&quot;)
  {
    vals = location.search.substr(1).split(&quot;&amp;&quot;);
    for (var i in vals)
    {
      vals[i] = vals[i].replace(/\+/g, &quot; &quot;).split(&quot;=&quot;);
    }

    //look for the parameter named 'data'
    var found = false;
        var datavals;
    for (var j in vals)
    {
      if (vals[j][0].toLowerCase() == &quot;data&quot;)
      {
        found = true;
        datavals = decodeURIComponent(vals[j][1]).split(&quot;|&quot;);
        for (var k in datavals)
        {
          datavals[k] = datavals[k].replace(/\+/g, &quot; &quot;).split(&quot;=&quot;);
        }
        break;
      }
    }
    if (found) { return datavals; }
  }
  return null;
};
  &lt;/script&gt;
  &lt;style type=&quot;text/css&quot;&gt;
.staroff,.staron,.stardel,.stardel2 {
	height:15px;
	margin:1px 1px 1px 2px;
	width:15px
}

staroff,.staron,.stardel {
	background:no-repeat
}

.starholder {
	background:#FFF;
	padding:1px
}

.stardel {
	background:url(remove.png)
}

.staron {
	background:url(staron.png)
}

.staron,.staroff {
	margin-right:5px
}

.staroff {
	background:url(staroff.png)
}

.value {
	font:11px segoe ui,tahoma,arial;
	color:#000;
	height:17px;
	vertical-align:middle
}
  &lt;/style&gt;
&lt;/head&gt;

&lt;body onload=&quot;Rating.Initialize();&quot;&gt;
  &lt;table cellspacing=&quot;0&quot;
         cellpadding=&quot;0&quot;
         width=&quot;100%&quot;
         summary=&quot;star table&quot;&gt;
    &lt;tr&gt;
      &lt;td id=&quot;cell_dd&quot;&gt;
        &lt;div id=&quot;starholder&quot;
             style=&quot;width:100%;&quot;
             onmouseover=&quot;Rating.HolderRollover();&quot;
             onmouseout=&quot;Rating.HolderRollout();&quot;&gt;&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<table>
<tr>
<td>These are the image files used:</td>
<td>
<a href="http://mscrmblogger.com/wp-content/uploads/2011/09/msblog_ratingstaron.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/msblog_ratingstaron.png" alt="" title="msblog_ratingstaron" width="15" height="15" class="aligncenter size-full wp-image-785" /></a></td>
<td>
<a href="http://mscrmblogger.com/wp-content/uploads/2011/09/msblog_ratingstaroff.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/msblog_ratingstaroff.png" alt="" title="msblog_ratingstaroff" width="15" height="15" class="aligncenter size-full wp-image-784" /></a></td>
<td>
<a href="http://mscrmblogger.com/wp-content/uploads/2011/09/msblog_ratingremove.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/msblog_ratingremove.png" alt="" title="msblog_ratingremove" width="15" height="15" class="aligncenter size-full wp-image-783" /></a></td>
<td>(<i>they are hidden in the managed solution</i>)</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/09/20/crm-2011-star-rating-control/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Use Microsoft Translator to translate text in CRM (Button on Ribbon)</title>
		<link>http://mscrmblogger.com/2011/09/14/use-microsoft-translator-to-translate-text-in-crm-button-on-ribbon/</link>
		<comments>http://mscrmblogger.com/2011/09/14/use-microsoft-translator-to-translate-text-in-crm-button-on-ribbon/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 15:58:19 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Addons]]></category>
		<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[General API Usage]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[bing translator]]></category>
		<category><![CDATA[cases]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[microsoft translator]]></category>
		<category><![CDATA[ribbon]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=695</guid>
		<description><![CDATA[Ever want to translate text from within CRM?  This solution adds a button on the ribbon to translate text from other languages to english using the Microsoft Bing Translator.]]></description>
			<content:encoded><![CDATA[<p>Do you have issues receiving request or information in various languages and need it translated to English (or another language)?  I found the need to translate something from any language to english just so when someone submits a case or puts some notes in another language it can quickly be translated.</p>
<p>Here is what my bing translator integration looks like.</p>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/09/translator-screenshot.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/translator-screenshot.png" alt="" title="Implemented Translator Screenshot" width="730" height="671" class="aligncenter size-full wp-image-706" /></a></p>
<p>You can download an unmanaged solution to implement the bing translator for cases, letters, tasks, and emails, you can download it here: <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/Translate_1_0.zip'>Translate_1_0.zip</a>.  It will not modify your forms, but if you have unmanaged ribbon buttons on those entities, it will remove them.  So to avoid that problem you can install <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/Translate_1_0-ImageJS.zip'>the unmanaged solution with the JScript (that you need to edit to set your bing api key) and the images</a>, and then follow the RibbonDiff guide in the SDK to add the buttons, or install <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/Translate_1_0-Ribbon-Managed.zip'>the managed solution</a> to add the button to the ribbons for cases, letters, tasks, and emails.</p>
<p>To start, I created a JScript file to include as a web-resource that I could leverage when a button is clicked on the ribbon.  This JScript file utilizes the Bing Translation WebServices to translate text.</p>
<p><i><b>YOU WILL NEED TO EDIT THE JSCRIPT FILE AND CHANGE &#8216;YOUR API KEY GOES HERE&#8217; TO CONTAIN YOUR API KEY.</b></i></p>
<pre name="code" class="javascript">
var bing = {};
bing.popup = {};
bing.language = {};

bing.appId = 'YOUR API KEY GOES HERE';
bing.language.text = '';
bing.language.from = '';
bing.language.to = 'en';

bing.language.detect = function (text,oncomplete)
{
  var src = &quot;https://api.microsofttranslator.com/V2/Ajax.svc/Detect?oncomplete=&quot; +
      oncomplete + &quot;&amp;appId=&quot;+ bing.appId + &quot;&amp;text=&quot; + text;
  var s = document.createElement(&quot;script&quot;);
  s.src = src;
  s.id = &quot;bingdetect&quot;;
  document.getElementsByTagName(&quot;head&quot;)[0].appendChild(s);
}

bing.language.translate = function(from,to,text,oncomplete)
{
  var src = &quot;https://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=&quot; +
      oncomplete + &quot;&amp;appId=&quot; + bing.appId + &quot;&amp;from=&quot; + from +
      &quot;&amp;to=&quot; + to + &quot;&amp;text=&quot; + text;

  var s = document.createElement(&quot;script&quot;);
  s.src = src;
  s.id = &quot;bingtranslate&quot;;
  document.getElementsByTagName(&quot;head&quot;)[0].appendChild(s);
}

bing.popup.show = function(text)
{
  var idiv = document.createElement('div');
  idiv.id = &quot;bingtext&quot;;
  idiv.style.height = &quot;265px&quot;;
  idiv.style.width = &quot;306px&quot;;
  idiv.style.align = &quot;left&quot;;
  idiv.style.textAlign = &quot;left&quot;;
  idiv.style.backgroundColor = &quot;white&quot;;
  idiv.style.overflow = &quot;auto&quot;;
  idiv.style.padding = &quot;2px&quot;;
  idiv.style.margin = &quot;2px&quot;;
  idiv.style.border = &quot;1px solid black&quot;;
  idiv.innerHTML =  &quot;&lt;p&gt;&quot;+text+&quot;&lt;/p&gt;&quot;;

  var iurl = Xrm.Page.context.getServerUrl();
  iurl += &quot;WebResources/tran_img/translatelogo.gif&quot;;

  var img = document.createElement('img');
  img.src = iurl;

  var div = document.createElement('div');
  div.id = &quot;bingpopup&quot;;
  div.appendChild(img);
  div.appendChild(idiv);
  div.innerHTML += &quot;&lt;button style='text-align:center;width:60px;' onclick='bing.popup.copy();'&gt;Copy&lt;/button&gt;&amp;nbsp;&amp;nbsp;&quot;;
  div.innerHTML += &quot;&lt;button style='text-align:center;width:60px;' onclick='bing.popup.hide();'&gt;Close&lt;/button&gt;&quot;;
  div.style.position = &quot;absolute&quot;;
  div.style.backgroundColor = &quot;#20415F&quot;;
  div.style.border=&quot;1px solid black&quot;;
  div.style.left = &quot;50%&quot;;
  div.style.top = &quot;50%&quot;;
  div.style.color = &quot;black&quot;;
  div.style.padding = &quot;5px&quot;;
  div.style.width = &quot;320px&quot;;
  div.style.height = &quot;340px&quot;;
  div.style.marginLeft = &quot;-160px&quot;;
  div.style.marginTop = &quot;-170px&quot;;
  div.setAttribute(&quot;align&quot;,&quot;center&quot;);
  document.getElementsByTagName(&quot;body&quot;)[0].appendChild(div);
}

bing.popup.hide = function()
{
  var deleteElement = function(id) {
    var el = document.getElementById(id);
    el.parentNode.removeChild(el);
  }

  deleteElement(&quot;bingpopup&quot;);
  deleteElement(&quot;bingdetect&quot;);
  deleteElement(&quot;bingtranslate&quot;);
}

bing.popup.copy = function()
{
  var el = document.getElementById('bingtext');

  if (window.clipboardData &amp;&amp; window.clipboardData.setData)
  {
    window.clipboardData.setData(&quot;Text&quot;, el.innerText);
  }
}

bing.getSelectedText = function (p)
{
  if (p.getSelection)
  {
    text = p.getSelection();
  }
  else if (p.selection)
  {
    text = p.selection.createRange().text;
  }
  return text;
}

// get current control
bing.language.toolbarClick = function (ctrl)
{
  var text = '';
  if (window.getSelection)
  {
    text = window.getSelection();
  }
  else {
    text = bing.getSelectedText(document);
  }

  if (text==null || text=='') {
    if (ctrl==null) {
      ctrl = Xrm.Page.ui.getCurrentControl();
    }

    var entityName = Xrm.Page.data.entity.getEntityName();
    if (ctrl==null &amp;&amp; entityName.match(/letter|email|task/)) {
      ctrl = Xrm.Page.ui.controls.get('description');
    }

    if (ctrl==null) {
      alert('Please highlight the text to translate.');
      return;
    }

    if (ctrl.getControlType()!=&quot;standard&quot;) {
      return; // only standard
    }

    if (ctrl.getName()==&quot;notescontrol&quot;) {
      text = bing.getSelectedText(document.frames['notescontrol'].document);
      if (text==null || text == &quot;&quot;) {
        alert('Please highlight the text to translate.');
      }
    }

    if (text == null || text == &quot;&quot;) {
      var attr = ctrl.getAttribute();
      if (attr!=null) {
        var t = attr.getAttributeType();
        if (t.match(/string|memo/))
        {
          text = attr.getValue();
        }
      }
    }
  }

  if (text == null || text == &quot;&quot;) {
    // Nothing to translate
    return;
  }  

  text = encodeURIComponent(text);
  bing.language.text = text;

  bing.language.from = '';
  bing.language.detect(text,&quot;translate&quot;);
}

window.translate = function (response)
{
  bing.language.from = response;
  bing.language.translate(bing.language.from,bing.language.to,bing.language.text,&quot;translated&quot;);
}

window.translated = function (response)
{
  bing.popup.show(response);
}
</pre>
<p>The JScript uses the Bing Translate logo image (WebResources/tran_img/translatelogo.gif &#8211; you may need to change the path in the JScript):</p>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/09/bingtranslatelogo.gif"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/bingtranslatelogo.gif" alt="" title="Bing Translator Logo" width="145" height="39" class="aligncenter size-full wp-image-700" /></a></p>
<p>I added some images for Microsoft Translate button images:</p>
<p><center></p>
<table style="background-color:white;padding:20px;color:black">
<tr>
<td style="border:1px solid black;height:65px;padding:7px;">
<a href="http://mscrmblogger.com/wp-content/uploads/2011/09/tran_icontranslate_16x16.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/tran_icontranslate_16x16.png" alt="" title="tran_icontranslate_16x16" width="16" height="16" /></a><br />16&#215;16 image<br />tran_icontranslate_16x16.png
</td>
<td style="width:20px" />
<td style="border:1px solid black;height:65px;padding:7px;">
<a href="http://mscrmblogger.com/wp-content/uploads/2011/09/tran_icontranslate_32x32.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/09/tran_icontranslate_32x32.png" alt="" title="tran_icontranslate_32x32" width="32" height="32" /></a><br />32&#215;32 image<br />tran_icontranslate_32x32.png
</td>
</tr>
</table>
<p>
</center></p>
<p>Then I added the buttons to the ribbons on the entities I wanted to have bing translation capabilities by following the <a href="http://msdn.microsoft.com/en-us/library/gg334341.aspx">SDK guidelines to add a button</a>.  Here is the RibbonDiffXml for a case.  You can follow the guide to change it to be on different entities.</p>
<pre name="code" class="xml">
&lt;RibbonDiffXml&gt;
  &lt;CustomActions&gt;
    &lt;CustomAction Id=&quot;bing.incident.form.Bing.CustomAction&quot;
                  Location=&quot;Mscrm.Form.incident.MainTab.Groups._children&quot;
                  Sequence=&quot;110&quot;&gt;
    &lt;CommandUIDefinition&gt;
      &lt;Group Id=&quot;bing.incident.form.Bing.Group&quot;
             Command=&quot;bing.incident.form.Bing.Command&quot;
             Title=&quot;$LocLabels:bing.incident.Bing.Title&quot;
             Sequence=&quot;39&quot;
             Template=&quot;Mscrm.Templates.Flexible2&quot;
             Image32by32Popup=&quot;$webresource:tran_icon/translate_32x32.png&quot;&gt;
      &lt;Controls Id=&quot;bing.incident.form.Bing.Controls&quot;&gt;
        &lt;Button Id=&quot;bing.incident.form.Bing.Button.BingTranslator&quot;
                Command=&quot;bing.incident.Bing.Button.BingTranslator.Command&quot;
                Sequence=&quot;10&quot;
                LabelText=&quot;$LocLabels:bing.incident.Bing.Button.BingTranslator.LabelText&quot;
                ToolTipTitle=&quot;$LocLabels:bing.incident.Bing.Button.BingTranslator.LabelText&quot;
                ToolTipDescription=&quot;$LocLabels:bing.incident.Bing.Button.BingTranslator.Description&quot;
                TemplateAlias=&quot;isv&quot;
                Image16by16=&quot;$webresource:tran_icon/translate_16x16.png&quot;
                Image32by32=&quot;$webresource:tran_icon/translate_32x32.png&quot; /&gt;
      &lt;/Controls&gt;
      &lt;/Group&gt;
    &lt;/CommandUIDefinition&gt;
    &lt;/CustomAction&gt;
    &lt;CustomAction Id=&quot;bing.incident.form.Bing.Popup.CustomAction&quot;
                  Location=&quot;Mscrm.Form.incident.MainTab.Scaling._children&quot;
                  Sequence=&quot;140&quot;&gt;
    &lt;CommandUIDefinition&gt;
      &lt;Scale Id=&quot;bing.incident.form.Bing.Popup.1&quot;
             GroupId=&quot;bing.incident.form.Bing.Group&quot;
             Sequence=&quot;85&quot;
             Size=&quot;Popup&quot; /&gt;
    &lt;/CommandUIDefinition&gt;
    &lt;/CustomAction&gt;
    &lt;CustomAction Id=&quot;bing.incident.form.Bing.MaxSize.CustomAction&quot;
                  Location=&quot;Mscrm.Form.incident.MainTab.Scaling._children&quot;
                  Sequence=&quot;120&quot;&gt;
    &lt;CommandUIDefinition&gt;
      &lt;MaxSize Id=&quot;bing.incident.form.Bing.MaxSize&quot;
               GroupId=&quot;bing.incident.form.Bing.Group&quot;
               Sequence=&quot;21&quot;
               Size=&quot;LargeLarge&quot; /&gt;
    &lt;/CommandUIDefinition&gt;
    &lt;/CustomAction&gt;
  &lt;/CustomActions&gt;
  &lt;Templates&gt;
    &lt;RibbonTemplates Id=&quot;Mscrm.Templates&quot;&gt;&lt;/RibbonTemplates&gt;
  &lt;/Templates&gt;
  &lt;CommandDefinitions&gt;
    &lt;CommandDefinition Id=&quot;bing.incident.Bing.Button.BingTranslator.Command&quot;&gt;
    &lt;EnableRules /&gt;
    &lt;DisplayRules /&gt;
    &lt;Actions&gt;
      &lt;JavaScriptFunction Library=&quot;$webresource:tran_js/bing.translate.js&quot;
                          FunctionName=&quot;bing.language.toolbarClick&quot;&gt;
      &lt;CrmParameter Value=&quot;SelectedControl&quot; /&gt;
      &lt;/JavaScriptFunction&gt;
    &lt;/Actions&gt;
    &lt;/CommandDefinition&gt;
    &lt;CommandDefinition Id=&quot;bing.incident.form.Bing.Command&quot;&gt;
    &lt;EnableRules&gt;&lt;/EnableRules&gt;
    &lt;DisplayRules /&gt;
    &lt;Actions /&gt;
    &lt;/CommandDefinition&gt;
  &lt;/CommandDefinitions&gt;
  &lt;RuleDefinitions&gt;
    &lt;TabDisplayRules /&gt;
    &lt;DisplayRules /&gt;
    &lt;EnableRules /&gt;
  &lt;/RuleDefinitions&gt;
  &lt;LocLabels&gt;
    &lt;LocLabel Id=&quot;bing.incident.Bing.Title&quot;&gt;
    &lt;Titles&gt;
      &lt;Title languagecode=&quot;1033&quot;
             description=&quot;Bing&quot; /&gt;
    &lt;/Titles&gt;
    &lt;/LocLabel&gt;
    &lt;LocLabel Id=&quot;bing.incident.Bing.Button.BingTranslator.LabelText&quot;&gt;
    &lt;Titles&gt;
      &lt;Title languagecode=&quot;1033&quot;
             description=&quot;Translate&quot; /&gt;
    &lt;/Titles&gt;
    &lt;/LocLabel&gt;
    &lt;LocLabel Id=&quot;bing.incident.Bing.Button.BingTranslator.Description&quot;&gt;
    &lt;Titles&gt;
      &lt;Title languagecode=&quot;1033&quot;
             description=&quot;Translate text area with bing!&quot; /&gt;
    &lt;/Titles&gt;
    &lt;/LocLabel&gt;
  &lt;/LocLabels&gt;
&lt;/RibbonDiffXml&gt;
</pre>
<p>Here are the files to download if you want to use it:</p>
<ul>
<li>Option A
<ul>
<li>Complete unmanaged solution: <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/Translate_1_0.zip'>Translate_1_0.zip</a></li>
</ul>
</li>
<li>Option B
<ul>
<li>Unmanaged Image and JScript solution: <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/Translate_1_0-ImageJS.zip'>Translate_1_0-ImageJS.zip</a>
<ul>
<li>You will need to edit the JScript to set your Bing API key.</li>
</ul>
</li>
<li>Managed Solution for the Ribbons on cases, letters, tasks, and emails: <a href='http://mscrmblogger.com/wp-content/uploads/2011/09/Translate_1_0-Ribbon-Managed.zip'>Translate_1_0-Ribbon-Managed.zip</a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/09/14/use-microsoft-translator-to-translate-text-in-crm-button-on-ribbon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Duplicate Account Name Checking for CRM Online &amp; CRM 2011 using the SoundsLikePlugin</title>
		<link>http://mscrmblogger.com/2011/05/16/duplicate-check-soundslikeplugin/</link>
		<comments>http://mscrmblogger.com/2011/05/16/duplicate-check-soundslikeplugin/#comments</comments>
		<pubDate>Mon, 16 May 2011 17:48:05 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[CRM Online]]></category>
		<category><![CDATA[crm2011]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[duplication]]></category>
		<category><![CDATA[find duplicates]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[metaphone]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[soundex]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=580</guid>
		<description><![CDATA[<p>Here is an example to help people understand how you can leverage the SoundsLikePlugin to do duplicate checking on Account Names that sound like other Account Names.  You can leverage it on other entities, etc.</p>]]></description>
			<content:encoded><![CDATA[<p>Just as an example to help people understand how you can leverage the SoundsLikePlugin, here is how to set it up for Account Name using Metaphone.  You should pay attention to your config xml, which I posted in a previous article: <a href="http://mscrmblogger.com/2011/05/15/soundslikeplugin/">SoundsLikePlugin: Soundex &amp; Metaphone Plugin for CRM Online</a>.  You can leverage the plugin and duplication detection on other entities.  You just need to adjust the configuration and steps accordingly for another entity and fields.</p>
<h1>Create a Solution</h1>
<ol>
<li>Create a Solution</li>
<li>Add the Account as an existing entity</li>
<li>Add two new fields, new_SoundexName and new_MetaphoneName and put them on the Account form as read-only</li>
<li>Save and Publish all changes</li>
</ol>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc1.png" alt=""/></p>
<h1>Register the plugin assembly</h1>
<p>The first step is to register the plugin assembly, to do that you will need to use the Plugin Registration Tool, which is included in the sdk (uncompiled). </p>
<h2>Compiling the Plugin Registration Tool</h2>
<ol>
<li>Open the solution, pluginregistration.sln in tools\pluginregistration folder inside the SDK with Visual Studio 2010</li>
<li>Compile (Build) the solution</li>
<li>Navigate to the tools\pluginregistration\bin\Debug folder in the SDK.</li>
<li>Launch the Plugin Registration Tool by double-clicking the PluginRegistration.exe</li>
</ol>
<h2>Connecting to CRM Online or OnPremise</h2>
<ol>
<li>Enter the Label, &#8220;CRM Online&#8221; for CRM Online for example</li>
<li>Enter the discovery url.  For CRM Online the discovery url is <a href="https://dev.crm.dynamics.com">https://dev.crm.dynamics.com</a>
<ul>
<li>If you have any problems authenticating, try deleting the %userprofile%\LiveDeviceID\LiveDevice.xml</li>
</ul>
<p></p>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc2.png" alt=""/></p>
</li>
<li>Select the Organization in the Connections in the left window pane</li>
</ol>
<h2>Registering the Assembly</h2>
<ol>
<li>Click the <b>Register</b> button, then click <b>Register New Assembly</b>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc3.png" alt=""/></p>
</li>
<li>Click the … button in Step #1 and select the SoundsLikePlugin.dll file.
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc4.png" alt=""/></p>
</li>
<li>Click <strong>Register Selected Plugins</strong>, then click <strong>Ok</strong> on the window that says they were successfully registered.</li>
</ol>
<h1>Register the Steps</h1>
<ol>
<li>Select the Assembly, then click <strong>Register</strong>, then <strong>Register New Step</strong>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc5.png" alt=""/></p>
</li>
<li>Enter <i>Create</i> for the Message</li>
<li>Enter <i>account</i> for the Primary Entity</li>
<li>Enter your <a href="http://mscrmblogger.com/2011/05/15/soundslikeplugin/">configuration xml</a></li>
<li>Select Pre-Validation</li>
<li>(Optional) Check the box for Offline Deployment</li>
<li>Register the Step
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_Create.png" alt=""/></p>
</li>
<li>Select the Assembly again, then click <strong>Register</strong>, then <strong>Register New Step</strong></li>
<li>Enter Update for the Message</li>
<li>Enter account for the Primary Entity</li>
<li>Enter your <a href="http://mscrmblogger.com/2011/05/15/soundslikeplugin/">configuration xml</a></li>
<li>Click the three dots (…) for the filtering attributes field, make sure to check the checkbox for all of the source and target fields you specify in your configuration</li>
<li>Select Pre-validation</li>
<li>(Optional) Check the box for Offline Deployment</li>
<li>Register the Step
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_Update.png" alt=""/></p>
</li>
</ol>
<h1>Setup the Duplicate Detection Rule</h1>
<ol>
<li>Click <strong>Settings</strong>, then <strong>Data Management</strong>, <strong>then Duplicate Detection Rules</strong>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc9.png" alt=""/></p>
</li>
<li>Click <strong>New</strong> to create a new duplicate detection rule</li>
<li>Enter the Name: Account Name sounds like another account name</li>
<li>Select the Base Record Type: Account</li>
<li>Select the Field: <em>Metaphone Name</em> and the Criteria: <em>Exact Match</em>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc10.png" alt=""/></p>
</li>
<li>Save and Publish the rule</li>
</ol>
<h1>Create a Duplicate Detection Job</h1>
<ol>
<li>Click <strong>Settings</strong>, then <strong>Data Management</strong>, <strong>then Duplicate Detection Jobs</strong>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc11.png" alt=""/></p>
</li>
<li>Click <strong>New</strong> to create a new Duplicate Detection Job</li>
<li>Set it up according to your requirements</li>
<li>Click <strong>Next</strong></li>
<li>Click <strong>Submit</strong></li>
</ol>
<h1>Run the Duplicate Detection Job and View Duplicates</h1>
<p>When the job runs, you can view the duplicates by going back to the Job and clicking <strong>View Duplicates</strong></p>
<p style="text-align:center"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/051611_1747_DuplicateAc13.png" alt=""/></p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/05/16/duplicate-check-soundslikeplugin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SoundsLikePlugin: Soundex &amp; Metaphone Plugin for CRM Online</title>
		<link>http://mscrmblogger.com/2011/05/15/soundslikeplugin/</link>
		<comments>http://mscrmblogger.com/2011/05/15/soundslikeplugin/#comments</comments>
		<pubDate>Sun, 15 May 2011 22:47:51 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[manipulationlibrary]]></category>
		<category><![CDATA[metaphone]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[soundex]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=540</guid>
		<description><![CDATA[<p>In response to request, I have taken the Soundex and Metaphone codification from the manipulation library and turned it into a plugin, the SoundsLikePlugin.  It uses an xml configuration on the plugin step to specify the fields to codify and where to store the results.</p>]]></description>
			<content:encoded><![CDATA[<p>In a previous comment and discussion on my blog and codeplex I was asked to convert the Metaphone and Soundex codification routies in the manipulation library to be plugins instead of custom workflow activities.  And yesterday I finally got a chance to take the code from the manipulation library and tweak the metaphone and soundex classes to be used in a plugin.  After about an hour of sporadically working on it while watching TV with my beautiful wife I had a version that was ready for testing.  This afternoon I tested it, and it appears to be working properly, so I figured I&#8217;d go ahead and share it.</p>
<p>In response to requests I added a new project to the <a href="http://manipulationlibrary.codeplex.com">manipulation library</a> on codeplex.  The new project, SoundsLikePlugin, allows you to utilize soundex, soundex original, and my metaphone-like codification through a plugin for CRM Online and CRM 2011.  The unsecure configuration contains the codification settings that specify the fields to encode, etc.  It will work both Server side and Offline (with the Outlook client).</p>
<p>Here is an example configuration (<i>config xml</i>):</p>
<pre name="code" class="xml">
<config>
<codify target="new_SoundexName" method="soundex" />
<codify source="name" target="new_SoundexOriginalName" method="soundex-original" max="3" disable-manual-update="true" />
<codify source="name" target="new_Metaphone" method="metaphone" min="3" max="20" />
</config>
</pre>
<p>That configuration uses the name field and codifies it using 3 different methods to 3 different fields.  The way the plugin is setup you can do however many soundex/metaphone codifications you need to on an entity.</p>
<p>The attributes in the codify element are very simple.  There are 6 different attributes you can specify:</p>
<ul>
<li><b>method</b>:
<ul>
<li>Description: The method of codification <i>soundex</i>, <i>soundex-original</i>, and <i>metaphone</i>.</li>
<li>Default: The default method is metaphone.</li>
</ul>
</li>
<li><b>source</b>: 
<ul>
<li>Description: The field that contains the string to codify</li>
<li>Default: The field called &quot;name&quot; &#8211; if the field does not exists, then the default won&#8217;t work</li>
</ul>
</li>
<li><b>target</b>: 
<ul>
<li>Description: The target field in which to store the codified string</li>
</ul>
</li>
<li><b>disable-manual-update</b>: 
<ul>
<li>Description: When true, it will prevent the target field from being set manually</li>
<li>Default: false</li>
</ul>
</li>
<li><b>min</b>: 
<ul>
<li>Description: The minimum number of characters</li>
<li>Default: 0 (zero)</li>
</ul>
</li>
<li><b>max</b>: 
<ul>
<li>Description: The maximum number of characters</li>
<li>Default: 6</li>
</ul>
</li>
</ul>
<p>To register the plugin you should first compile or download the plugin, use the plugin registration tool to register the assemby, and add the corresponding steps for the update and create messages on the entities with the configuration xml in the unsecured or secured configuration.</p>
<p>However, since there are a lot of people that read my blog that may not be experts at registering a plugin, I&#8217;ll go ahead and walk you through the entire process.</p>
<p><b>How to register and setup the SoundsLikePlugin:</b></p>
<ol>
<li>Download the <a href="http://manipulationlibrary.codeplex.com/releases">SoundsLikePlugin.dll</a></li>
<li>Follow the steps <a href="http://www.mscrmdirectory.com/2010/09/crm-2011-beta-online-plug-in-registration-tool/">here</a> to setup the Plugin Registration Tool (It is in the SDK &#8211; tools\pluginregistration) 
<ul>
<li><i>The above link refers to an article written by Paul Reitmeyer.  It has screenshots that may help you navigate how to use the plugin registration tool.</i></li>
</ul>
</li>
<li>Run the Plugin Registration Tool</li>
<li>Connect to your Discovery Service
<ul>
<li><i>If you are using CRM Online, the discovery url is <b>https://dev.crm.dynamics.com</b> &#8211; if you have any problems authenticating, try deleting the <b>%userprofile%\LiveDeviceID\LiveDevice.xml</b></i></li>
</ul>
</li>
<li>Select your organization on the left</li>
<li>In the right pane, on the toolbar, click the <b>Register</b> button, then click <b>Register New Assembly</b></li>
<li>Click the three dots (&#8230;) in the top right of the window, then browse and select the SoundsLikePlugin.dll</li>
<li>Make sure Step #3 has Sandbox selected and Step #4 has Database selected</li>
<li>Click the <b>Register Selected Plugins</b> button</li>
<li>Expand the assembly, click on (Plugin) SoundsLike.SoundsLikePlugin</li>
<li>Click <b>Register</b>, then <b>Register New Step</b></li>
<li>Registering the Create/Update Steps:
<ol>
<li>Enter <b>Create</b> in the Message Name</li>
<li>Enter the entity in the Primary entity field</li>
<li>Click the three dots (&#8230;) for the filtering attributes field, make sure to check the checkbox for all of the source and target fields you specify in your configuration</li>
<li>Paste in a config xml into the unsecured configuration</li>
<li>Select Pre-operation (CRM 2011 Only)</li>
<li>Check the box for Server and Offline</li>
<li>Click the <b>Register New Step</b> button</li>
</ol>
</li>
<li>Repeat the above section on registering the step for the Update message.</li>
<li>Open CRM and test &#8211; you should always test</li>
</ol>
<p></p>
<p>There you have it, a way to codify a text field using soundex, metaphone, or even the orginal soundex.</p>
<p>To quote Wikipedia:</p>
<blockquote><p>Soundex was developed by Robert C. Russell and Margaret K. Odell and patented in 1918 and 1922. A variation called American Soundex was used in the 1930s for a retrospective analysis of the US censuses from 1890 through 1920. The Soundex code came to prominence in the 1960s when it was the subject of several articles in the Communications and Journal of the Association for Computing Machinery, and especially when described in Donald Knuth&#8217;s The Art of Computer Programming.</p>
<p>The National Archives and Records Administration (NARA) maintains the current rule set for the official implementation of Soundex used by the U.S. Government. These encoding rules are available from NARA, upon request, in the form of General Information Leaflet 55, &#8220;Using the Census Soundex&#8221;.</p></blockquote>
<p>If you&#8217;re interested in SoundEx or Metaphone, I&#8217;d suggest reading up on it on Wikipedia.  My metaphone algorithm is not an exact match, but I think it is close enought to do the job adequately.  Over time changes have been made for slavic, germanic, etc. and some of those changes are incorporated in my version while some of them are not.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/05/15/soundslikeplugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CRM Attachment Image for CRM 2011 Entities</title>
		<link>http://mscrmblogger.com/2011/05/10/crm-attachment-image-for-crm-2011-entities/</link>
		<comments>http://mscrmblogger.com/2011/05/10/crm-attachment-image-for-crm-2011-entities/#comments</comments>
		<pubDate>Tue, 10 May 2011 15:34:35 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[CodePlex]]></category>
		<category><![CDATA[contact]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=440</guid>
		<description><![CDATA[<p>In a previous post I provided a screenshot with a contact photo on the form.  I have now released a version of the Silverlight control on codeplex at <a href="http://crmattachmentimage.codeplex.com">CRMAttachmentImage.CodePlex.com</a>.  It is a Silverlight control for adding images to any entity form in CRM 2011.</p>]]></description>
			<content:encoded><![CDATA[<p><i>The CRMAttachmentImage control downloads on codeplex have been updated to include gif and webcam support that I talk about in a <a href="http://mscrmblogger.com/2011/09/15/adding-imagetools-to-the-crm-attachment-image-for-crm-2011/">new article</a> that includes some instructions that may be helpful.</i></p>
<p>A while back Christian asked about this image control I had in a screenshot on one of my posts.  And while it was ok, it was far from being something I would throw into a production environment.  It was a starting point.  I am proud to say that I have put the Silverlight control on codeplex at <a href="http://crmattachmentimage.codeplex.com">CRMAttachmentImage.CodePlex.com</a>.  It is in beta because I am still working on putting the buttons on the ribbon instead of in the control.</p>
<p><a href="http://mscrmblogger.com/wp-content/uploads/2011/03/ContactForm.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/03/ContactForm.png" alt="Contact Form - with Attachment Image Silverlight Control" title="Contact Form with CRM Attachment Image Silverlight Control" width="897" height="647" class="aligncenter size-full wp-image-365" /></a></p>
<p><i>** If anyone has any ideas for loading a file in JavaScript and sending it to the Silverlight control to load the data, I&#8217;m open to suggestions.</i></p>
<p>The image itself is stored as an attachment in the notes.  This way the control is utilizing CRM and not an external system to handle the images.  Simply put in order to use this your users will need to be able to read notes and create them.  They will also need the &quot;Customization &gt; ISV Extensions&quot; permission.  If you are not seeing the images, and everything else is right, then try checking the permissions.</p>
<p>Instructions are posted on the codeplex site, but it is fairly straight forward to add to a form.  First, you just upload the web-resource and create a text field to store the guid for the not (annotationid).  It <b>MUST BE ON THE FORM</b>, but it does not need to be visible, and you probably don&#8217;t want to make it searchable.  The web resource does require the id and type to be passed, and some additional parameters.</p>
<p>The parameters are separated by a pipe | instead of a comma.  An example parameter is:</p>
<pre>field=new_imageattachmentid|subject='Contact''s Image'|prefix='img-'</pre>
<p>Check out the full parameter list at <a href="http://crmattachmentimage.codeplex.com">CRMAttachmentImage.CodePlex.com</a>.  If you have any suggestions or comments, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/05/10/crm-attachment-image-for-crm-2011-entities/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>SilverCrmSoap: A Silverlight CRM Soap Library for CRM 2011</title>
		<link>http://mscrmblogger.com/2011/04/26/silvercrmsoap-a-silverlight-crm-soap-library-for-crm-2011/</link>
		<comments>http://mscrmblogger.com/2011/04/26/silvercrmsoap-a-silverlight-crm-soap-library-for-crm-2011/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 17:56:11 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[crm sdk]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=421</guid>
		<description><![CDATA[<p>SilverCrmSoap is a library built using the methods in <a href="http://msdn.microsoft.com/en-us/library/gg594452.aspx">Walkthrough: Use the SOAP Endpoint for Web Resources with Silverlight</a>. The SilverCrmSoap library simplifies SOAP Silverlight development for CRM 2011 by providing a class that does a lot of the heavy lifting right out of the box.</p>
<p>You can check out the SilverCrmSoap library on <a href="http://silvercrmsoap.codeplex.com/">CodePlex</a> or read more about it on the <a href="http://blogs.msdn.com/b/crm/archive/2011/04/26/silvercrmsoap-a-crm-soap-library-for-crm-2011.aspx">CRM Team Blog</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>SilverCrmSoap is a library built using the methods in <a href="http://msdn.microsoft.com/en-us/library/gg594452.aspx">Walkthrough: Use the SOAP Endpoint for Web Resources with Silverlight</a>. The SilverCrmSoap library simplifies SOAP Silverlight development for CRM 2011 by providing a class that does a lot of the heavy lifting right out of the box.</p>
<p>In essence, the SilverCrmSoap library objectifies FetchXml allowing you to modify it easily in code, adds an XrmHelper for calling the context and page functions from a Silverlight application, a FormHelper for setting values on a form, and a SoapHelper for making all of your SOAP calls.  It becomes a real time saver because you don&#8217;t have to recompile it.  And, if your curious where/when to use it, it&#8217;s pretty straight forward.  If you need SOAP for CRM, then use the library and save time.</p>
<p>How do you know to use SOAP vs REST?</p>
<p><b>Use SOAP when&#8230;</b></p>
<ul>
<li>You need to use late binding to create a dynamic Silverlight application that works with any (or multiple) entities.</li>
<li>You need to execute a message.</li>
<li>You need to assign records.</li>
<li>You need to retrieve metadata.</li>
</ul>
<p>There are benefits to using the REST endpoint too, and being able to quickly leverage both end points in a project can be extremely helpful.</p>
<p><b>Use REST when&#8230;</b></p>
<ul>
<li>You need to early bind to objects.</li>
<li>You want to leverage LINQ with the early bound objects.</li>
<li>You want compile time type support and IntelliSense.</li>
</ul>
<p>You can check out the SilverCrmSoap library on <a href="http://silvercrmsoap.codeplex.com/">CodePlex</a> or read more about it on the <a href="http://blogs.msdn.com/b/crm/archive/2011/04/26/silvercrmsoap-a-crm-soap-library-for-crm-2011.aspx">CRM Team Blog</a>.</p>
<p>Enjoy!</p>
<p>-MSCRMBlogger</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/04/26/silvercrmsoap-a-silverlight-crm-soap-library-for-crm-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

