<?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>crmexplorer.com</title>
	<atom:link href="http://crmexplorer.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://crmexplorer.com</link>
	<description>Sharing tips, tricks and experiences using Microsoft Dynamics CRM</description>
	<lastBuildDate>Thu, 10 Nov 2011 13:17:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Disable / enable fields, sections, tabs and the whole form in CRM 2011</title>
		<link>http://crmexplorer.com/2011/11/disable-wnable-fields-sections-tabs-and-the-whole-form-in-crm-2011/</link>
		<comments>http://crmexplorer.com/2011/11/disable-wnable-fields-sections-tabs-and-the-whole-form-in-crm-2011/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 16:00:55 +0000</pubDate>
		<dc:creator>Eirik</dc:creator>
				<category><![CDATA[CRM 2011]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://crmexplorer.com/?p=38</guid>
		<description><![CDATA[When working with CRM, you often want to enable (set to read/write) or disable (set to read / only) selected fields, sections, tabs and the whole form depending on your business logic. This is can be derived from studying the SDK &#8230; <a href="http://crmexplorer.com/2011/11/disable-wnable-fields-sections-tabs-and-the-whole-form-in-crm-2011/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When working with CRM, you often want to enable (set to read/write) or disable (set to read / only) selected fields, sections, tabs and the whole form depending on your business logic. This is can be derived from studying the SDK and creating som code, but here are my easy-to-use support functions to complement the base functions.</p>
<p><strong>1) Enable / Disable a field</strong></p>
<pre class="brush: jscript; title: ; notranslate">
Xrm.Page.getControl(&quot;fieldname&quot;).setDisabled(false);  // true = R/W, false = R/O
</pre>
<p><strong>2) Enable / Disable a Section</strong></p>
<pre class="brush: jscript; title: ; notranslate">
function sectiondisable (sectionname, disablestatus)
{
    var ctrlName = Xrm.Page.ui.controls.get();
    for(var i in ctrlName) {
         var ctrl = ctrlName[i];
         var ctrlSection = ctrl.getParent().getName();
         if (ctrlSection == sectionname) {
               ctrl.setDisabled(disablestatus);
        }
    }
}  // sectiondisable
</pre>
<p><strong>3) Enable / Disable a Tab</strong></p>
<pre class="brush: jscript; title: ; notranslate">
function tabdisable (tabname, disablestatus)
{
 var tab = Xrm.Page.ui.tabs.get(tabname);
 if (tab == null) alert(&quot;Error: The tab: &quot; + tabname + &quot; is not on the form&quot;);
 else {
     var tabsections =  tab.sections.get();
     for (var i in tabsections) {
         var secname = tabsections[i].getName();
         sectiondisable(secname, disablestatus);
     }
  }
}   // tabdisable
</pre>
<p><strong>4) Enable / Disable a Form</strong></p>
<pre class="brush: jscript; title: ; notranslate">
function formdisable(disablestatus)
{
    var allAttributes = Xrm.Page.data.entity.attributes.get();
    for (var i in allAttributes) {
           var myattribute = Xrm.Page.data.entity.attributes.get(allAttributes[i].getName());
           var myname = myattribute.getName();          
           Xrm.Page.getControl(myname).setDisabled(disablestatus); 
    }
} // formdisable
</pre>
]]></content:encoded>
			<wfw:commentRss>http://crmexplorer.com/2011/11/disable-wnable-fields-sections-tabs-and-the-whole-form-in-crm-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remember old / previous values in CRM form</title>
		<link>http://crmexplorer.com/2011/08/remember-old-values/</link>
		<comments>http://crmexplorer.com/2011/08/remember-old-values/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 11:29:10 +0000</pubDate>
		<dc:creator>Eirik</dc:creator>
				<category><![CDATA[CRM 2011]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://crmexplorer.com/?p=25</guid>
		<description><![CDATA[A typical need is to remember a previous value on a CRM form, so that if a user makes an error, we can set the field back to its original value. The problem is that when we run an on change &#8230; <a href="http://crmexplorer.com/2011/08/remember-old-values/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A typical need is to remember a previous value on a CRM form, so that if a user makes an error, we can set the field back to its original value. The problem is that when we run an on change event function on a field we of course get the new value. We want to know what the original value was.</p>
<p>Let&#8217;s say we have a CRM field called global_importantfield. We could make an extra field called global_oldvalueofimportantfield and put this on a hidden part of the form. Then by Javascripting you could set the value of global_oldvalueofimportantfield to the global_importantfield upon load. This is not an ideal solution since you then create uneccessary database fields. Also, if you have many fields where such initial / previous values are needed, you will need to create a lot of fields.</p>
<p>A smarter approach is to create a function that we on load will populate with our initial values. Then we can call upon this dummy function with the right &#8220;variable&#8221; from other Javascript functions.  We can also change and modify the content of these variables from other functions. This is how it is done:</p>
<p>You have a jscript web resource for the entity. In this you have your functions and code.</p>
<p><strong>1) Code that is run onload:</strong></p>
<pre class="brush: jscript; title: ; notranslate">
if ( Xrm.Page.getAttribute('global_importantfield').getValue() != null  )  
   InitValues.IMPFIELD = Xrm.Page.getAttribute('global_importantfield').getValue();
 else InitValues.IMPFIELD = &quot;&quot;;
if ( Xrm.Page.getAttribute('global_anotherfield').getValue() != null  )  
   InitValues.ANOTHERFIELD = Xrm.Page.getAttribute('global_anotherfield').getValue();
 else InitValues.ANOTHERFIELD = &quot;&quot;;
// End of onload code
</pre>
<p><strong>2) Then you must have a dummy function in your jscript web resource:</strong></p>
<pre class="brush: jscript; title: ; notranslate">
function InitValues() { }
</pre>
<p><strong>3) Usage in other functions</strong></p>
<p>To use and manipulate these values - your can for example have the following code in the function that is run on-event for the  global_importantfield:</p>
<pre class="brush: jscript; title: ; notranslate">
var newcontent = Xrm.Page.getAttribute('global_importantfield').getValue();
alert(&quot;The new value is:&quot; + newcontent );
alert(&quot;And here is the previous value&quot; + InitValues.IMPFIELD);&lt;/pre&gt;
</pre>
<p>If let&#8217;s say that the user confirms the choice, you might want to set the IMPFIELD to the new choice right away since it else will only be updated on a new save and load of the form:</p>
<pre class="brush: jscript; title: ; notranslate">
InitValues.IMPFIELD = newcontent; 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://crmexplorer.com/2011/08/remember-old-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choice of tracking token may mark your emails as spam</title>
		<link>http://crmexplorer.com/2010/12/choice-of-tracking-token-may-mark-your-emails-as-spam/</link>
		<comments>http://crmexplorer.com/2010/12/choice-of-tracking-token-may-mark-your-emails-as-spam/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 21:09:40 +0000</pubDate>
		<dc:creator>Eirik</dc:creator>
				<category><![CDATA[CRM 4]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[Marketing]]></category>

		<guid isPermaLink="false">http://crmexplorer.com/?p=22</guid>
		<description><![CDATA[Avoid email sent from CRM to end up as spam due to the wrong tracking token setup <a href="http://crmexplorer.com/2010/12/choice-of-tracking-token-may-mark-your-emails-as-spam/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had an interesting experience with sending marketing mails from CRM. I usually have a test list where I send new outbound mails to check how they look in different e-mail clients etc. I discovered that my own e-mails from CRM were caught by our company spam filter and marked as spam. After some testing I discovered that the culprit was the use of the &#8220;:&#8221; in the tracking token for our CRM e-mail setup. Our tracking token was of the form xxxxx ErgoGroup:000324. You can quite easily change the tracking token in CRM 4 by going to System Settings &#8211; E-mail.</p>
<p>You cannot have a prefix just with ErgoGroup + a space to get a token such as &#8220;ErgoGroup 00324&#8243;, it will always end up as &#8220;ErgoGroup00324&#8243;, and this kind of text in the message header might also mark the email as spam. I therefore changed the prefix to &#8220;ErgoGroup n&#8221;, so that  the tracking token that gets created look like this: &#8220;ErgoGroup n00234&#8243;. This looks OK on e-mails to our customers, and most important: our messages do not end up marked as spam.</p>
]]></content:encoded>
			<wfw:commentRss>http://crmexplorer.com/2010/12/choice-of-tracking-token-may-mark-your-emails-as-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing our CRM travels&#8230;</title>
		<link>http://crmexplorer.com/2010/11/sharing-our-crm-travels/</link>
		<comments>http://crmexplorer.com/2010/11/sharing-our-crm-travels/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 21:02:47 +0000</pubDate>
		<dc:creator>Eirik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://crmexplorer.com/?p=13</guid>
		<description><![CDATA[This site is about sharing our experiences working with Microsoft Dynamics CRM. Even if we all work at EDB ErgoGroup, this is a personal project &#8211; and all opinions and statements are our own, and not in any way condoned &#8230; <a href="http://crmexplorer.com/2010/11/sharing-our-crm-travels/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This site is about sharing our experiences working with Microsoft Dynamics CRM. Even if we all work at EDB ErgoGroup, this is a personal project &#8211; and all opinions and statements are our own, and not in any way condoned or sanctioned by the company.</p>
<p>We hope the articles here will be of use for you regardless if you are a power user, a system customizer or a CRM developer.</p>
]]></content:encoded>
			<wfw:commentRss>http://crmexplorer.com/2010/11/sharing-our-crm-travels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

