<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Meghshyam Gaur&#039;s Blog</title>
	<atom:link href="http://meghshyam.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://meghshyam.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Tue, 10 Jan 2012 05:13:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='meghshyam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Meghshyam Gaur&#039;s Blog</title>
		<link>http://meghshyam.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://meghshyam.wordpress.com/osd.xml" title="Meghshyam Gaur&#039;s Blog" />
	<atom:link rel='hub' href='http://meghshyam.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Session(Cookies) in Javascript in MS CRM</title>
		<link>http://meghshyam.wordpress.com/2012/01/10/sessioncookies-in-javascript-in-ms-crm/</link>
		<comments>http://meghshyam.wordpress.com/2012/01/10/sessioncookies-in-javascript-in-ms-crm/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 05:13:48 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=83</guid>
		<description><![CDATA[Today i have got one requirement from my client about calculate money value with respect to exchange rate of currency when user change the currency on form. Its quite a simple when it comes to writing plugin on Post Stage and Pre image update because for this we require current as well as new currency [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=83&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today i have got one requirement from my client about calculate money value with respect to exchange rate of currency when user change the currency on form.</p>
<p>Its quite a simple when it comes to writing plugin on Post Stage and Pre image update because for this we require current as well as new currency  exchange rates. Now if we think of doing this using Javascript, then 1st thing that comes in my mind was to use session or viewstate in javascript.</p>
<p>Then after several tries i found something related to creating cookies where i can store and retrieve the value whenever required.</p>
<p>So i am sharing a piece of code to store and retrieve the cookies on onload and on change.</p>
<p>Now this function gives me the exchange rate after selecting the currency:</p>
<p>function Calculatexchangerate() {</p>
<p>//Old Exchange Rate using cookies<br />
var oldExchangeRate=readCookie(&#8220;nameval&#8221;);<br />
//check the Account  if currency field have value or not<br />
if (Xrm.Page.getAttribute(&#8220;transactioncurrencyid&#8221;).getValue()!= null) {<br />
var currencyid= Xrm.Page.getAttribute(&#8220;transactioncurrencyid&#8221;).getValue()[0].id;<br />
var objAuthenticationHeader = GenerateAuthenticationHeader();<br />
// Prepare the SOAP message.</p>
<p>var xml = &#8220;&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;utf-8&#8242;?&gt;&#8221; +<br />
&#8220;&lt;soap:Envelope xmlns:soap=&#8217;http://schemas.xmlsoap.org/soap/envelope/&#8217;&#8221; +<br />
&#8221; xmlns:xsi=&#8217;http://www.w3.org/2001/XMLSchema-instance&#8217;&#8221; +<br />
&#8221; xmlns:xsd=&#8217;http://www.w3.org/2001/XMLSchema&#8217;&gt;&#8221; +<br />
objAuthenticationHeader +<br />
&#8220;&lt;soap:Body&gt;&#8221; +<br />
&#8220;&lt;Retrieve xmlns=&#8217;http://schemas.microsoft.com/crm/2007/WebServices&#8217;&gt;&#8221; +<br />
&#8220;&lt;entityName&gt;transactioncurrency&lt;/entityName&gt;&#8221; +<br />
&#8220;&lt;id&gt;&#8221; + currencyid + &#8220;&lt;/id&gt;&#8221; +<br />
&#8220;&lt;columnSet xmlns:q1=&#8217;http://schemas.microsoft.com/crm/2006/Query&#8217; xsi:type=&#8217;q1:ColumnSet&#8217;&gt;&#8221; +<br />
&#8220;&lt;q1:Attributes&gt;&#8221; +<br />
&#8220;&lt;q1:Attribute&gt;exchangerate&lt;/q1:Attribute&gt;&#8221; +<br />
&#8220;&lt;/q1:Attributes&gt;&#8221; +<br />
&#8220;&lt;/columnSet&gt;&#8221; +<br />
&#8220;&lt;/Retrieve&gt;&#8221; +<br />
&#8220;&lt;/soap:Body&gt;&#8221; +<br />
&#8220;&lt;/soap:Envelope&gt;&#8221;;</p>
<p>// Prepare the xmlHttpObject and send the request.<br />
var objHReq = new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);<br />
objHReq.Open(&#8220;POST&#8221;, &#8220;/mscrmservices/2007/CrmService.asmx&#8221;, false);<br />
objHReq.setRequestHeader(&#8220;SOAPAction&#8221;, &#8220;http://schemas.microsoft.com/crm/2007/WebServices/Retrieve&#8221;);<br />
objHReq.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;text/xml; charset=utf-8&#8243;);<br />
objHReq.setRequestHeader(&#8220;Content-Length&#8221;, xml.length);<br />
objHReq.send(xml);</p>
<p>// Capture the result.<br />
var sResultXml = objHReq.responseXML;<br />
var sResultText = objHReq.responseText;<br />
//alert(sResultText);<br />
// Check for errors.<br />
var iErrorCount = sResultXml.selectNodes(&#8216;//error&#8217;).length;<br />
var iexchangerate;</p>
<p>if (iErrorCount != 0) {<br />
var sMsg = sResultXml.selectSingleNode(&#8216;//description&#8217;).nodeTypedValue;<br />
alert(sMsg);<br />
}</p>
<p>// Display the retrieved value.<br />
else {</p>
<p>//check the Volume Per Unit field have value or not<br />
if (sResultXml.selectSingleNode(&#8220;//q1:exchangerate&#8221;) != null) {<br />
iexchangerate= sResultXml.selectSingleNode(&#8220;//q1:exchangerate&#8221;).nodeTypedValue;<br />
if(isNaN(iexchangerate))<br />
iexchangerate=0.0;<br />
//alert(iexchangerate);</p>
<p>}</p>
<p>}</p>
<p>&nbsp;</p>
<p>Now to store the current exchange rate and retrieve it on onchange event of currency we need to use two functions</p>
<p>function createCookie(name,value,days) {<br />
if (days) {<br />
var date = new Date();<br />
date.setTime(date.getTime()+(days*24*60*60*1000));<br />
var expires = &#8220;; expires=&#8221;+date.toGMTString();<br />
}<br />
else var expires = &#8220;&#8221;;<br />
document.cookie = name+&#8221;=&#8221;+value+expires+&#8221;; path=/&#8221;;<br />
}</p>
<p>function readCookie(name) {<br />
var nameEQ = name + &#8220;=&#8221;;<br />
var ca = document.cookie.split(&#8216;;&#8217;);<br />
for(var i=0;i &lt; ca.length;i++) {<br />
var c = ca[i];<br />
while (c.charAt(0)==&#8217; &#8216;) c = c.substring(1,c.length);<br />
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);<br />
}<br />
return null;<br />
}</p>
<p>&nbsp;</p>
<p>to use these two functions we can call these functions as</p>
<p>to Store:  createCookie(&#8220;nameval&#8221;,iexchangerate ,1);</p>
<p>to Remove: createCookie(&#8220;nameval&#8221;,iexchangerate ,-1);</p>
<p>to Retrieve: readCookie(&#8220;nameval&#8221;);</p>
<p>&nbsp;</p>
<p>Please share your comments if it helps you somewhere.</p>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/uncategorized/'>Uncategorized</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=83&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2012/01/10/sessioncookies-in-javascript-in-ms-crm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Dynamics CRM 2011 Calling OnKeyDown With Javascript</title>
		<link>http://meghshyam.wordpress.com/2011/12/14/dynamics-crm-2011-calling-onkeyup-with-javascript/</link>
		<comments>http://meghshyam.wordpress.com/2011/12/14/dynamics-crm-2011-calling-onkeyup-with-javascript/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 06:29:58 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=75</guid>
		<description><![CDATA[Recently I have been working on a solution in Dynamics CRM 2011, which required me to provide the character left to write in a textbox field , as the user is typing into the field.  This ‘Characters left’ field needed to be live updating every time someone enters a character into the text field, so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=75&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I have been working on a solution in Dynamics CRM 2011, which required me to provide the character left to write in a textbox field , as the user is typing into the field.  This ‘Characters left’ field needed to be live updating every time someone enters a character into the text field, so using the standard methods of ‘onChange’ would not quite work, as it would only update once you click out of the field.</p>
<p><img title="Calling JavaScript on Key Press of a Dynamics CRM 1" src="http://paulnieuwelaar.files.wordpress.com/2011/05/calling-javascript-on-key-press-of-a-dynamics-crm-1.jpg?w=614" alt="" /></p>
<div>
<p>I first got the JScript working on the fields onchange, so that when someone clicks out of the text box after entering data, the Characters Remaining field will be set to 160 minus the field values length. This was easily achieved using the following JScript, with the ‘keyPress’ function being called onchange on the text field.</p>
<p>function keyPress() {<br />
var messageVal =document.getElementById(&#8220;description”).value;<br />
var maxLength = 160;<br />
if (messageVal != &#8221; &amp;&amp; messageVal.length  &lt;= 160 &amp;&amp; messageVal.length  &gt; 0) {<br />
var msgLength = messageVal.length;<br />
var remaining = maxLength – msgLength;<br />
Xrm.Page.getAttribute(&#8220;core_smslength&#8221;).setValue(remaining);<br />
}</p>
<p>else if(messageVal ==&#8221;) {</p>
<p>Xrm.Page.getAttribute(&#8220;core_smslength&#8221;).setValue(maxLength);</p>
<p>}<br />
}</p>
<p><em><strong>Note:</strong> WordPress formats code weird, to download all code used in this blog post click here.</em></p>
<p>In this example, the <strong>charRemaining</strong> variable sets the ‘Characters Remaining’ field, and the <strong>message</strong> variable sets the name of the text field we’re entering data into. Also the <strong>maxLength</strong> variable sets the starting value of the Characters Remaining field (this will be what it counts down from, in this case 100).</p>
<p><img title="Calling JavaScript on Key Press of a Dynamics CRM 2" src="http://paulnieuwelaar.files.wordpress.com/2011/05/calling-javascript-on-key-press-of-a-dynamics-crm-2.jpg?w=614" alt="" /></p>
<p>So using this alone works well, however it doesn’t work each time we type a character, which is what we want to happen. So to do this we need to call the function above when a character is typed within our text field. I eventually found the following line of code which will fire the ‘keyPress’ function when a key is pressed inside the text field.</p>
<p>document.getElementById(“description”).onkeypress = keyPress;</p>
<p>However this was where the first ‘gotcha’ happened. Although adding the above line of code to the onload event would fire the ‘keyPress’ function when a key was pressed, it would not include certain characters such as backspace, enter, or delete. Other options were using ‘onkeydown’ instead of ‘onkeypress’, although this didn’t quite work as expected either, as it was only called when the next key was pressed, where as we wanted to fire when the current key was pressed. So instead we used ‘onkeyup’ which did the job, although using this method didn’t fire the event until the key was released, so if you held down a key it wouldn’t change the Characters Remaining until you released that key. After a bit of testing, I found that adding 2 separate lines for ‘onkeyup’ and ‘onkeydown’ worked exactly how we wanted. The full function to call in the onload looks like this:</p>
<p>function onLoad() {<br />
var messagecontrol=document.getElementById(&#8220;description”);<br />
messagecontrol.attachEvent(&#8220;onkeyup&#8221;,keyPress);<br />
}</p>
<p><img title="Calling JavaScript on Key Press of a Dynamics CRM 3" src="http://paulnieuwelaar.files.wordpress.com/2011/05/calling-javascript-on-key-press-of-a-dynamics-crm-3.jpg?w=614" alt="" /></p>
<p>While this was now firing the keyPress event correctly, the Characters Remaining wasn’t changing until you clicked out of the text field. I discovered this was because the ‘message length’ isn’t saved until you click out of the field. However I managed to find a work around for this. Instead of using ‘Xrm.Page.getAttribute’ to get the message field, I used ‘document.getElementById’. Which when used with message length got the current length of the field at the time.</p>
<p>This was now working exactly as I wanted, the last step was to add the keyPress function to the onload, so that when the form loads, the Characters Remaining will be set to the correct amount. I’ve added the full JScript file below:</p>
<p>function keyPress() {<br />
var messageVal =document.getElementById(&#8220;description”).value;<br />
var maxLength = 160;<br />
if (messageVal != &#8221;) {<br />
var msgLength = messageVal.length;<br />
var remaining = maxLength – msgLength;<br />
Xrm.Page.getAttribute(&#8220;core_smslength&#8221;).setValue(remaining);<br />
}<br />
else {<br />
Xrm.Page.getAttribute(&#8220;core_smslength&#8221;).setValue(maxLength);<br />
}<br />
}</p>
<p>function onLoad() {<br />
var messagecontrol=document.getElementById(&#8220;description”);<br />
messagecontrol.attachEvent(&#8220;onkeyup&#8221;,keyPress);<br />
}</p>
<p><a href="http://meghshyam.files.wordpress.com/2011/12/1.jpg"><img class="alignleft size-medium wp-image-79" title="Final" src="http://meghshyam.files.wordpress.com/2011/12/1.jpg?w=300&#038;h=246" alt="" width="300" height="246" /></a></p>
</div>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/uncategorized/'>Uncategorized</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=75&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2011/12/14/dynamics-crm-2011-calling-onkeyup-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>

		<media:content url="http://paulnieuwelaar.files.wordpress.com/2011/05/calling-javascript-on-key-press-of-a-dynamics-crm-1.jpg?w=614" medium="image">
			<media:title type="html">Calling JavaScript on Key Press of a Dynamics CRM 1</media:title>
		</media:content>

		<media:content url="http://paulnieuwelaar.files.wordpress.com/2011/05/calling-javascript-on-key-press-of-a-dynamics-crm-2.jpg?w=614" medium="image">
			<media:title type="html">Calling JavaScript on Key Press of a Dynamics CRM 2</media:title>
		</media:content>

		<media:content url="http://paulnieuwelaar.files.wordpress.com/2011/05/calling-javascript-on-key-press-of-a-dynamics-crm-3.jpg?w=614" medium="image">
			<media:title type="html">Calling JavaScript on Key Press of a Dynamics CRM 3</media:title>
		</media:content>

		<media:content url="http://meghshyam.files.wordpress.com/2011/12/1.jpg?w=300" medium="image">
			<media:title type="html">Final</media:title>
		</media:content>
	</item>
		<item>
		<title>change business unit in MS CRM 4.0 through plugin</title>
		<link>http://meghshyam.wordpress.com/2011/06/29/change-business-unit-in-ms-crm-4-0-through-plugin/</link>
		<comments>http://meghshyam.wordpress.com/2011/06/29/change-business-unit-in-ms-crm-4-0-through-plugin/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:12:12 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Microsoft CRM Dynamics 4.0]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=72</guid>
		<description><![CDATA[SetBusinessSystemUserRequest _bunit= new SetBusinessSystemUserRequest(); //Target business Unit Id _bunit.BusinessId = targetbu.Value; //Target system user id _bunit.UserId = sysuserid.Value; _bunit.ReassignPrincipal = new SecurityPrincipal(); //Target System user or Team id _bunit.ReassignPrincipal.PrincipalId = sysuserid.Value; SetBusinessSystemUserResponse buresp = (SetBusinessSystemUserResponse)crmservice.Execute(_bunit); Filed under: Microsoft CRM Dynamics 4.0<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=72&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre>	SetBusinessSystemUserRequest _bunit= new SetBusinessSystemUserRequest();
//Target business Unit Id
_bunit.BusinessId = targetbu.Value;
//Target system user id
_bunit.UserId = sysuserid.Value;
_bunit.ReassignPrincipal = new SecurityPrincipal();
//Target System user or Team id
_bunit.ReassignPrincipal.PrincipalId = sysuserid.Value;
SetBusinessSystemUserResponse buresp = (SetBusinessSystemUserResponse)crmservice.Execute(_bunit);</pre>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/microsoft-crm-dynamics-4-0/'>Microsoft CRM Dynamics 4.0</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=72&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2011/06/29/change-business-unit-in-ms-crm-4-0-through-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Assign Security Role to user in MS CRM 4.0 through Plugin</title>
		<link>http://meghshyam.wordpress.com/2011/06/29/assign-security-role-to-user-in-ms-crm-4-0-through-plugin/</link>
		<comments>http://meghshyam.wordpress.com/2011/06/29/assign-security-role-to-user-in-ms-crm-4-0-through-plugin/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:09:58 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=70</guid>
		<description><![CDATA[AssignUserRolesRoleRequest request = new AssignUserRolesRoleRequest(); request.UserId = sysuserid.Value; //Security Roles ex.. Guid[] roles (array of GUID's) request.RoleIds = roles; AssignUserRolesRoleResponse response = (AssignUserRolesRoleResponse)crmservice.Execute(request); Filed under: Uncategorized<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=70&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre> AssignUserRolesRoleRequest request = new AssignUserRolesRoleRequest();
            request.UserId = sysuserid.Value;
//Security Roles ex.. Guid[] roles (array of GUID's)
            request.RoleIds = roles;
            AssignUserRolesRoleResponse response = (AssignUserRolesRoleResponse)crmservice.Execute(request);</pre>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/uncategorized/'>Uncategorized</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=70&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2011/06/29/assign-security-role-to-user-in-ms-crm-4-0-through-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Login logout info about Users in MS CRM</title>
		<link>http://meghshyam.wordpress.com/2011/06/29/login-logout-info-about-users-in-ms-crm/</link>
		<comments>http://meghshyam.wordpress.com/2011/06/29/login-logout-info-about-users-in-ms-crm/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:08:09 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Microsoft CRM Dynamics 4.0]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=68</guid>
		<description><![CDATA[here is some idea how to make it #1 make a custom entity named &#8220;LogUserInfo&#8221; and create the following minimun required attributes UserName : this will keep the users full name OrgName : the corresponding Organization name , this will help in multi-tenancy environment. LoginTime : the login time of the user(it will be calculated [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=68&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>here is some idea how to make it</p>
<p><strong>#1</strong> <strong>make a custom entity named &#8220;LogUserInfo&#8221; and create the following minimun required attributes</strong><br />
UserName : this will keep the users full name<br />
OrgName : the corresponding Organization name , this will help in multi-tenancy environment.<br />
LoginTime : the login time of the user(it will be calculated once the loader.aspx page will get loaded.)<br />
LogoutTime : the log out time of the user(it will be calculated once the user will X-off means close the browser or refresh the main window)</p>
<p><strong>#2</strong> <strong>write the following bunch of code in the loader.aspx page which is available in the inetpub\wwwroot\, with in the javascript tag</strong><strong><br />
</strong><br />
//register the onload and unonload events 1st<br />
window.onload = logLoginInfo;<br />
window.onunload = logLogoutInfo;</p>
<p>//get user full name<br />
function getUserFullName(){<br />
//Create the XML that will fetch the required info.<br />
//You can inspect this web service call using a tool called FIDDLER.<br />
var XMLRequest = &#8220;&#8221; +<br />
&#8220;&lt;?xml version=\&#8221;1.0\&#8221; encoding=\&#8221;utf-8\&#8221;?&gt;&#8221; +<br />
&#8220;&lt;soap:Envelope xmlns:soap=\&#8221;http://schemas.xmlsoap.org/soap/envelope/\&#8221; xmlns:xsi=\&#8221;http://www.w3.org/2001/XMLSchema-instance\&#8221; xmlns:xsd=\&#8221;http://www.w3.org/2001/XMLSchema\&#8221;&gt;&#8221; +<br />
GenerateAuthenticationHeader() +<br />
&#8221; &lt;soap:Body&gt;&#8221; +<br />
&#8221; &lt;RetrieveMultiple xmlns=\&#8221;http://schemas.microsoft.com/crm/2007/WebServices\&#8221;&gt;&#8221; +<br />
&#8221; &lt;query xmlns:q1=\&#8221;http://schemas.microsoft.com/crm/2006/Query\&#8221; xsi:type=\&#8221;q1:QueryExpression\&#8221;&gt;&#8221; +<br />
&#8221; &lt;q1:EntityName&gt;systemuser&lt;/q1:EntityName&gt;&#8221; +<br />
&#8221; &lt;q1:ColumnSet xsi:type=\&#8221;q1:ColumnSet\&#8221;&gt;&#8221; +<br />
&#8221; &lt;q1:Attributes&gt;&#8221; +<br />
&#8221; &lt;q1:Attribute&gt;systemuserid&lt;/q1:Attribute&gt;&#8221; +<br />
&#8221; &lt;q1:Attribute&gt;fullname&lt;/q1:Attribute&gt;&#8221; +<br />
&#8221; &lt;/q1:Attributes&gt;&#8221; +<br />
&#8221; &lt;/q1:ColumnSet&gt;&#8221; +<br />
&#8221; &lt;q1:Distinct&gt;false&lt;/q1:Distinct&gt;&#8221; +<br />
&#8221; &lt;q1:Criteria&gt;&#8221; +<br />
&#8221; &lt;q1:FilterOperator&gt;And&lt;/q1:FilterOperator&gt;&#8221; +<br />
&#8221; &lt;q1:Conditions&gt;&#8221; +<br />
&#8221; &lt;q1:Condition&gt;&#8221; +<br />
&#8221; &lt;q1:AttributeName&gt;systemuserid&lt;/q1:AttributeName&gt;&#8221; +<br />
&#8221; &lt;q1:Operator&gt;EqualUserId&lt;/q1:Operator&gt;&#8221; +<br />
&#8221; &lt;/q1:Condition&gt;&#8221; +<br />
&#8221; &lt;/q1:Conditions&gt;&#8221; +<br />
&#8221; &lt;/q1:Criteria&gt;&#8221; +<br />
&#8221; &lt;/query&gt;&#8221; +<br />
&#8221; &lt;/RetrieveMultiple&gt;&#8221; +<br />
&#8221; &lt;/soap:Body&gt;&#8221; +<br />
&#8220;&lt;/soap:Envelope&gt;&#8221; +<br />
&#8220;&#8221;;<br />
try{<br />
//Create Http request object<br />
var xmlHttpRequest = new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);<br />
xmlHttpRequest.Open(&#8220;POST&#8221;, &#8220;/mscrmservices/2007/CrmService.asmx&#8221;, false);<br />
xmlHttpRequest.setRequestHeader(&#8220;SOAPAction&#8221;,&#8221;http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple&#8221;);<br />
xmlHttpRequest.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;text/xml; charset=utf-8&#8243;);<br />
xmlHttpRequest.setRequestHeader(&#8220;Content-Length&#8221;, XMLRequest.length);<br />
xmlHttpRequest.send(XMLRequest);<br />
//alert(&#8220;aaa&#8221;+xmlHttpRequest.responseText);<br />
//Store the response which would be XML<br />
var Result = xmlHttpRequest.responseXML;<br />
/*<br />
The return is of type &#8220;BusinessEntity&#8221; if you were using similar code one server side.<br />
Hence we need to select node of type &#8220;BusinessEntity&#8221;<br />
In our case It should be not more one than one node<br />
*/<br />
var BusinessEntityNodes = Result.selectNodes(&#8220;//RetrieveMultipleResult/BusinessEntities/BusinessEntity&#8221;);<br />
// Check If data was retrived<br />
if (BusinessEntityNodes.length != 0){<br />
var BusinessEntityNode = BusinessEntityNodes[0];<br />
var SystemUserId = BusinessEntityNode.selectSingleNode(&#8220;q1:systemuserid&#8221;);<br />
var FullName = BusinessEntityNode.selectSingleNode(&#8220;q1:fullname&#8221;);<br />
var SystemUserId = (SystemUserId == null) ? null : SystemUserId.text;<br />
var FullName = (FullName == null) ? null : FullName.text;<br />
// alert(&#8220;FullName&#8221;+FullName);<br />
}<br />
return FullName;</p>
<p>} catch (e){<br />
alert(e.message);<br />
}<br />
}</p>
<p>//get the current Organization(tenant) name<br />
function getOrgName(){<br />
var url = window.location;<br />
var arr = url.toString().split(&#8220;/&#8221;);<br />
return arr[3];<br />
}</p>
<p>//get the just login time<br />
function getLoginOutTime(){<br />
var currentTime = new Date();<br />
var month = currentTime.getMonth() + 1;<br />
var day = currentTime.getDate();<br />
var year = currentTime.getFullYear();<br />
var hours = currentTime.getHours();<br />
var minutes = currentTime.getMinutes();<br />
var finalTime = month+&#8221;/&#8221;+day+&#8221;/&#8221;+year+&#8221; &#8220;+hours+&#8221;:&#8221;+minutes;<br />
if(hours &gt; 11){<br />
finalTime += &#8221; PM&#8221;;<br />
} else {<br />
finalTime += &#8221; AM&#8221;;<br />
}<br />
return finalTime;<br />
}<br />
//logging the login info<br />
var loginInfoGUID = &#8220;&#8221;;<br />
function logLoginInfo(){<br />
// Prepare values for the Login User Info.<br />
var sdv_username = getUserFullName();<br />
var sdv_orgname = getOrgName();<br />
var sdv_name = sdv_orgname +&#8221;_&#8221;+sdv_username;<br />
//var sdv_logintime = getLoginOutTime();<br />
var authenticationHeader = GenerateAuthenticationHeader();</p>
<p>// Prepare the SOAP message.<br />
var xml = &#8220;&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;utf-8&#8242;?&gt;&#8221; +<br />
&#8220;&lt;soap:Envelope xmlns:soap=&#8217;http://schemas.xmlsoap.org/soap/envelope/&#8217;&#8221;+<br />
&#8221; xmlns:xsi=&#8217;http://www.w3.org/2001/XMLSchema-instance&#8217;&#8221;+<br />
&#8221; xmlns:xsd=&#8217;http://www.w3.org/2001/XMLSchema&#8217;&gt;&#8221;+<br />
authenticationHeader+<br />
&#8220;&lt;soap:Body&gt;&#8221;+<br />
&#8220;&lt;Create xmlns=&#8217;http://schemas.microsoft.com/crm/2007/WebServices&#8217;&gt;&#8221;+<br />
&#8220;&lt;entity xsi:type=&#8217;sdv_loguserinfo&#8217;&gt;&#8221;+<br />
&#8220;&lt;sdv_name&gt;&#8221;+sdv_name+&#8221;&lt;/sdv_name&gt;&#8221;+<br />
&#8220;&lt;sdv_username&gt;&#8221;+sdv_username+&#8221;&lt;/sdv_username&gt;&#8221;+<br />
&#8220;&lt;sdv_orgname&gt;&#8221;+sdv_orgname+&#8221;&lt;/sdv_orgname&gt;&#8221;+<br />
// &#8220;&lt;sdv_logintime&gt;&#8221;+sdv_logintime+&#8221;&lt;/sdv_logintime&gt;&#8221;+<br />
&#8220;&lt;/entity&gt;&#8221;+<br />
&#8220;&lt;/Create&gt;&#8221;+<br />
&#8220;&lt;/soap:Body&gt;&#8221;+<br />
&#8220;&lt;/soap:Envelope&gt;&#8221;;<br />
//alert(&#8220;value&#8221;+xml);<br />
// Prepare the xmlHttpObject and send the request.<br />
var xHReq = new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);<br />
xHReq.Open(&#8220;POST&#8221;, &#8220;/mscrmservices/2007/CrmService.asmx&#8221;, false);<br />
xHReq.setRequestHeader(&#8220;SOAPAction&#8221;,&#8221;http://schemas.microsoft.com/crm/2007/WebServices/Create&#8221;);<br />
xHReq.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;text/xml; charset=utf-8&#8243;);<br />
xHReq.setRequestHeader(&#8220;Content-Length&#8221;, xml.length);<br />
xHReq.send(xml);<br />
// Capture the result<br />
var resultXml = xHReq.responseXML;<br />
//alert(&#8220;xml&#8221;+xHReq.responseText);<br />
xmlDoc = new ActiveXObject(&#8220;Microsoft.XMLDOM&#8221;);<br />
xmlDoc.async=false;<br />
xmlDoc.loadXML(xHReq.responseXML.xml);<br />
var guid = xmlDoc.getElementsByTagName(&#8220;CreateResult&#8221;);<br />
//this guid will be used for updating the logout time<br />
loginInfoGUID = guid[0].childNodes[0].text;<br />
//alert(&#8220;guid&#8221;+guid[0].childNodes[0].text);<br />
// Check for errors.<br />
var errorCount = resultXml.selectNodes(&#8216;//error&#8217;).length;<br />
if (errorCount != 0)<br />
{<br />
var msg = resultXml.selectSingleNode(&#8216;//description&#8217;).nodeTypedValue;<br />
alert(&#8220;Ignore it, It was for tracking the loging infos&#8221;+msg);<br />
}</p>
<p>else<br />
{<br />
//alert(&#8220;done&#8221;);<br />
}<br />
}</p>
<p>//logging the louout info<br />
function logLogoutInfo(){<br />
// Prepare variables for updating a contact.<br />
//var sdv_logouttime = getLoginOutTime();<br />
var authenticationHeader = GenerateAuthenticationHeader();</p>
<p>// Prepare the SOAP message.<br />
var xml = &#8220;&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;utf-8&#8242;?&gt;&#8221;+<br />
&#8220;&lt;soap:Envelope xmlns:soap=&#8217;http://schemas.xmlsoap.org/soap/envelope/&#8217;&#8221;+<br />
&#8221; xmlns:xsi=&#8217;http://www.w3.org/2001/XMLSchema-instance&#8217;&#8221;+<br />
&#8221; xmlns:xsd=&#8217;http://www.w3.org/2001/XMLSchema&#8217;&gt;&#8221;+<br />
authenticationHeader+<br />
&#8220;&lt;soap:Body&gt;&#8221;+<br />
&#8220;&lt;Update xmlns=&#8217;http://schemas.microsoft.com/crm/2007/WebServices&#8217;&gt;&#8221;+<br />
&#8220;&lt;entity xsi:type=&#8217;sdv_loguserinfo&#8217;&gt;&#8221;+<br />
//&#8221;&lt;sdv_logouttime&gt;&#8221;+sdv_logouttime+&#8221;&lt;/sdv_logouttime&gt;&#8221;+<br />
&#8220;&lt;sdv_loguserinfoid&gt;&#8221;+loginInfoGUID+&#8221;&lt;/sdv_loguserinfoid&gt;&#8221;+<br />
&#8220;&lt;/entity&gt;&#8221;+<br />
&#8220;&lt;/Update&gt;&#8221;+<br />
&#8220;&lt;/soap:Body&gt;&#8221;+<br />
&#8220;&lt;/soap:Envelope&gt;&#8221;;<br />
// Prepare the xmlHttpObject and send the request.<br />
var xHReq = new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);<br />
xHReq.Open(&#8220;POST&#8221;, &#8220;/mscrmservices/2007/CrmService.asmx&#8221;, false);<br />
xHReq.setRequestHeader(&#8220;SOAPAction&#8221;,&#8221;http://schemas.microsoft.com/crm/2007/WebServices/Update&#8221;);<br />
xHReq.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;text/xml; charset=utf-8&#8243;);<br />
xHReq.setRequestHeader(&#8220;Content-Length&#8221;, xml.length);<br />
xHReq.send(xml);<br />
// Capture the result<br />
var resultXml = xHReq.responseXML;</p>
<p>// Check for errors.<br />
var errorCount = resultXml.selectNodes(&#8216;//error&#8217;).length;<br />
if (errorCount != 0)<br />
{<br />
var msg = resultXml.selectSingleNode(&#8216;//description&#8217;).nodeTypedValue;<br />
alert(&#8220;Ignore it, It was for tracking the loging infos&#8221;+msg);<br />
}<br />
// Display a confirmation message and open the updated contact.<br />
else<br />
{<br />
// alert(&#8220;done&#8221;);<br />
}<br />
}</p>
<p>put the above code as it is, if you have created the custom entity with attributes as above.</p>
<p><strong>#3</strong> Finally one plugin need to be registered on ccreate and update of that entity to get the server time</p>
<p><strong>for precreate</strong></p>
<p>#region IPlugin Members</p>
<p>public void Execute(IPluginExecutionContext context)<br />
{<br />
try<br />
{<br />
DynamicEntity entity = getDynamicEntity(context, &#8220;sdv_loguserinfo&#8221;);<br />
entity.Properties.Add(new CrmDateTimeProperty(&#8220;sdv_logintime&#8221;, new CrmDateTime(DateTime.Now.ToString())));<br />
}<br />
catch (InvalidPluginExecutionException ipee)<br />
{<br />
throw ipee;<br />
}<br />
catch (Exception e)<br />
{<br />
throw new InvalidPluginExecutionException(&#8220;Uncaught Exception\r\n&#8221; + e.Message + &#8220;\r\n&#8221; + e.StackTrace);<br />
}<br />
}</p>
<p>#endregion</p>
<p>private static DynamicEntity getDynamicEntity(IPluginExecutionContext context, string name)<br />
{<br />
if (!(context.InputParameters.Properties.Contains(&#8220;Target&#8221;) &amp;&amp;<br />
context.InputParameters.Properties["Target"] is DynamicEntity))<br />
{<br />
return null;<br />
}</p>
<p>DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties["Target"];</p>
<p>if (entity.Name != name)<br />
{<br />
return null;<br />
}</p>
<p>return entity;<br />
}</p>
<p><strong>for preupdate</strong></p>
<p>#region IPlugin Members</p>
<p>public void Execute(IPluginExecutionContext context)<br />
{<br />
try<br />
{<br />
DynamicEntity entity = getDynamicEntity(context, &#8220;sdv_loguserinfo&#8221;);<br />
entity.Properties.Add(new CrmDateTimeProperty(&#8220;sdv_logouttime&#8221;, new CrmDateTime(DateTime.Now.ToString())));<br />
}<br />
catch (InvalidPluginExecutionException ipee)<br />
{<br />
throw ipee;<br />
}<br />
catch (Exception e)<br />
{<br />
throw new InvalidPluginExecutionException(&#8220;Uncaught Exception\r\n&#8221; + e.Message + &#8220;\r\n&#8221; + e.StackTrace);<br />
}<br />
}</p>
<p>#endregion</p>
<p>private static DynamicEntity getDynamicEntity(IPluginExecutionContext context, string name)<br />
{<br />
if (!(context.InputParameters.Properties.Contains(&#8220;Target&#8221;) &amp;&amp;<br />
context.InputParameters.Properties["Target"] is DynamicEntity))<br />
{<br />
return null;<br />
}</p>
<p>DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties["Target"];</p>
<p>if (entity.Name != name)<br />
{<br />
return null;<br />
}</p>
<p>return entity;<br />
}</p>
<p>&nbsp;</p>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/microsoft-crm-dynamics-4-0/'>Microsoft CRM Dynamics 4.0</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=68&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2011/06/29/login-logout-info-about-users-in-ms-crm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Query to find the missing right on the role in MS CRM 4.0</title>
		<link>http://meghshyam.wordpress.com/2011/06/29/sql-query-to-find-the-missing-right-on-the-role-in-ms-crm-4-0/</link>
		<comments>http://meghshyam.wordpress.com/2011/06/29/sql-query-to-find-the-missing-right-on-the-role-in-ms-crm-4-0/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:06:09 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Microsoft CRM Dynamics 4.0]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=66</guid>
		<description><![CDATA[select * from PrivilegeBase where PrivilegeId =&#8217;PrivilegeID&#8217; Filed under: Microsoft CRM Dynamics 4.0<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=66&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>select * from PrivilegeBase where PrivilegeId =&#8217;PrivilegeID&#8217;</p>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/microsoft-crm-dynamics-4-0/'>Microsoft CRM Dynamics 4.0</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=66&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2011/06/29/sql-query-to-find-the-missing-right-on-the-role-in-ms-crm-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Microsoft Dynamics CRM 4.0 – Hiding System Views</title>
		<link>http://meghshyam.wordpress.com/2011/06/29/microsoft-dynamics-crm-4-0-%e2%80%93-hiding-system-views/</link>
		<comments>http://meghshyam.wordpress.com/2011/06/29/microsoft-dynamics-crm-4-0-%e2%80%93-hiding-system-views/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:03:50 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Microsoft CRM Dynamics 4.0]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=64</guid>
		<description><![CDATA[If we need to hide System Views in MS CRM 4.0, then we should write a plug-in code which is time consuming. If you want to do it quickly, then we can hide the System Views with SQL update (unsupported) Example: If we want to hide ’Opportunities Closing Next Month’ System View from Opportunity entity [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=64&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre>If we need to hide System Views in MS CRM 4.0, then we should write a plug-in code which is time consuming.  If you want to do it quickly, then we can hide the System Views with SQL update (unsupported)

Example:
If we want to hide ’Opportunities Closing Next Month’ System View from Opportunity entity then use the below mentioned SQL update statement

update SavedQuery set IsPrivate = 1
where Name = ‘Opportunities Closing Next Month‘</pre>
<br />Filed under: <a href='http://meghshyam.wordpress.com/category/microsoft-crm-dynamics-4-0/'>Microsoft CRM Dynamics 4.0</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=64&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2011/06/29/microsoft-dynamics-crm-4-0-%e2%80%93-hiding-system-views/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Validation for finding character or numerical in string</title>
		<link>http://meghshyam.wordpress.com/2009/09/01/validation-for-finding-character-or-numerical-in-string/</link>
		<comments>http://meghshyam.wordpress.com/2009/09/01/validation-for-finding-character-or-numerical-in-string/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 14:47:16 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Microsoft CRM Dynamics 4.0]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=60</guid>
		<description><![CDATA[function checkPANCard(pancard) { debugger; var l_str1; var l_str2; var l_str3; if(pancard != null) { if(pancard.length != 10 ) { alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;); return null ; } else { l_str1 = pancard.charAt(0)+pancard.charAt(1)+pancard.charAt(2)+pancard.charAt(3)+pancard.charAt(4); if(!IsChar(l_str1)){ alert(&#8216;Please type your PAN Card No. correctly&#8217;); return null ; } l_str2 = pancard.charAt(5)+pancard.charAt(6)+pancard.charAt(7)+pancard.charAt(8); if(!IsInteger(l_str2)){ alert(&#8216;Please [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=60&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">function checkPANCard(pancard)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>debugger;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>var l_str1;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>var l_str2;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>var l_str3;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(pancard != null)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(pancard.length != 10 )</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> return null ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>else</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>l_str1<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>pancard.charAt(0)+pancard.charAt(1)+pancard.charAt(2)+pancard.charAt(3)+pancard.charAt(4);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(!IsChar(l_str1)){</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>alert(&#8216;Please type your PAN Card No. correctly&#8217;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>return null ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>l_str2<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>pancard.charAt(5)+pancard.charAt(6)+pancard.charAt(7)+pancard.charAt(8);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(!IsInteger(l_str2)){</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>alert(&#8216;Please type your PAN Card No. correctly&#8217;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>return null ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>l_str3<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>pancard.charAt(9);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(!IsChar(l_str3)){</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>alert(&#8216;Please type your PAN Card No. correctly&#8217;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>return null ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>var PanCardNo<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>l_str1+l_str2+l_str3;<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>return PanCardNo ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">function IsInteger(sText)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">var ValidChars = &#8220;0123456789&#8243;;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">var IsNumber=true;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">var Char;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">for (var i = 0; i &lt; sText.length &amp;&amp; IsNumber == true; i++) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Char = sText.charAt(i);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">if (ValidChars.indexOf(Char) == -1) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">IsNumber = false;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">return IsNumber;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">function IsChar(sText)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">var ValidChars = &#8220;ABCDEFGHIJKLMANOPQRSTUVWXYZ&#8221;;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">var isChar=true;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">var Char;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">for (var i = 0; i &lt; sText.length &amp;&amp; isChar == true; i++) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Char = sText.charAt(i);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">if (ValidChars.indexOf(Char) == -1) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">isChar = false;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">return isChar;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">function checkPhone(tel)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>//debugger;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">if(tel != null)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(tel.length != 10 )</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> return null ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>else</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>return tel ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div>here is the code for validation like pan cards where we have to follow the particular format of some thing like pancard so for this i have written a code&#8230;so take look.</div>
<div>function checkPANCard(pancard)</div>
<div>{</div>
<div><span style="white-space:pre;"> </span>debugger;</div>
<div><span style="white-space:pre;"> </span>var l_str1;</div>
<div><span style="white-space:pre;"> </span>var l_str2;</div>
<div><span style="white-space:pre;"> </span>var l_str3;</div>
<div><span style="white-space:pre;"> </span></div>
<div><span style="white-space:pre;"> </span>if(pancard != null)</div>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span>if(pancard.length != 10 )</div>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span> alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;);</div>
<div><span style="white-space:pre;"> </span> return null ;</div>
<div><span style="white-space:pre;"> </span>}<span style="white-space:pre;"> </span></div>
<div><span style="white-space:pre;"> </span>else</div>
<div><span style="white-space:pre;"> </span>{</div>
<div></div>
<div><span style="white-space:pre;"> </span>l_str1<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>pancard.charAt(0)+pancard.charAt(1)+pancard.charAt(2)+pancard.charAt(3)+pancard.charAt(4);</div>
<div><span style="white-space:pre;"> </span>if(!IsChar(l_str1)){</div>
<div><span style="white-space:pre;"> </span>alert(&#8216;Please type your PAN Card No. correctly&#8217;);</div>
<div><span style="white-space:pre;"> </span>return null ;</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>l_str2<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>pancard.charAt(5)+pancard.charAt(6)+pancard.charAt(7)+pancard.charAt(8);</div>
<div><span style="white-space:pre;"> </span>if(!IsInteger(l_str2)){</div>
<div><span style="white-space:pre;"> </span>alert(&#8216;Please type your PAN Card No. correctly&#8217;);</div>
<div><span style="white-space:pre;"> </span>return null ;</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>l_str3<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>pancard.charAt(9);</div>
<div><span style="white-space:pre;"> </span>if(!IsChar(l_str3)){</div>
<div><span style="white-space:pre;"> </span>alert(&#8216;Please type your PAN Card No. correctly&#8217;);</div>
<div><span style="white-space:pre;"> </span>return null ;</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>var PanCardNo<span style="white-space:pre;"> </span>=<span style="white-space:pre;"> </span>l_str1+l_str2+l_str3;<span style="white-space:pre;"> </span></div>
<div><span style="white-space:pre;"> </span>return PanCardNo ;</div>
<div><span style="white-space:pre;"> </span></div>
<div><span style="white-space:pre;"> </span>}</div>
<div>}</div>
<div><span style="white-space:pre;"> </span></div>
<div>function IsInteger(sText)</div>
<div>{</div>
<div>var ValidChars = &#8220;0123456789&#8243;;</div>
<div>var IsNumber=true;</div>
<div>var Char;</div>
<div></div>
<div></div>
<div>for (var i = 0; i &lt; sText.length &amp;&amp; IsNumber == true; i++) {</div>
<div>Char = sText.charAt(i);</div>
<div>if (ValidChars.indexOf(Char) == -1) {</div>
<div>IsNumber = false;</div>
<div>}</div>
<div>}</div>
<div>return IsNumber;</div>
<div>}</div>
<div></div>
<div></div>
<div>function IsChar(sText)</div>
<div>{</div>
<div>var ValidChars = &#8220;ABCDEFGHIJKLMANOPQRSTUVWXYZ&#8221;;</div>
<div>var isChar=true;</div>
<div>var Char;</div>
<div></div>
<div></div>
<div>for (var i = 0; i &lt; sText.length &amp;&amp; isChar == true; i++) {</div>
<div>Char = sText.charAt(i);</div>
<div>if (ValidChars.indexOf(Char) == -1) {</div>
<div>isChar = false;</div>
<div>}</div>
<div>}</div>
<div>return isChar;</div>
<div>}</div>
<div></div>
<div>paste this line in Ochanged code of your attribute&#8230;.</div>
<div></div>
<div>crmForm.all.new_pancardno.DataValue = checkPANCard(crmForm.all.new_pancardno.DataValue);</div>
<br />Posted in Microsoft CRM Dynamics 4.0  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=60&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2009/09/01/validation-for-finding-character-or-numerical-in-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Validate phone number</title>
		<link>http://meghshyam.wordpress.com/2009/09/01/validate-phone-number/</link>
		<comments>http://meghshyam.wordpress.com/2009/09/01/validate-phone-number/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 05:58:23 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Microsoft CRM Dynamics 4.0]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=57</guid>
		<description><![CDATA[function checkPhone(tel) { debugger; if(tel != null) { if(tel.length != 10 ) { alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;); return null ; } else return tel ; } } paste this ocde in C:\Inetpub\wwwroot\CRM\ISV\Entity\contact.js function checkPhone(tel) { debugger; if(tel != null) { if(tel.length != 10 ) { alert(&#8216;Phone Number not valid. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=57&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">function checkPhone(tel)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">debugger;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">if(tel != null)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>if(tel.length != 10 )</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> return null ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>else</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>return tel ;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div>paste this ocde in C:\Inetpub\wwwroot\CRM\ISV\Entity\contact.js</div>
<div></div>
<div>function checkPhone(tel)</div>
<div>{</div>
<div>debugger;</div>
<div>if(tel != null)</div>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span>if(tel.length != 10 )</div>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span> alert(&#8216;Phone Number not valid. It must be of 10 Digits&#8217;);</div>
<div><span style="white-space:pre;"> </span> return null ;</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>else</div>
<div><span style="white-space:pre;"> </span>return tel ;</div>
<div><span style="white-space:pre;"> </span>}</div>
<div>}</div>
<div></div>
<div>call it on onchange event on the phone no where u want to validate.</div>
<div>like this</div>
<div>crmForm.all.mobilephone.DataValue = checkPhone(crmForm.all.mobilephone.DataValue);</div>
<br />Posted in Microsoft CRM Dynamics 4.0  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=57&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2009/09/01/validate-phone-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable all the fields on the form in CRM</title>
		<link>http://meghshyam.wordpress.com/2009/09/01/disable-all-the-fields-on-the-form-in-crm/</link>
		<comments>http://meghshyam.wordpress.com/2009/09/01/disable-all-the-fields-on-the-form-in-crm/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 04:41:56 +0000</pubDate>
		<dc:creator>MeghShyam Gaur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://meghshyam.wordpress.com/?p=54</guid>
		<description><![CDATA[Here is the code to disable all the fields on the form in CRM, if(crmForm.formtype != 1) { for (var index in crmForm.all) { var control = crmForm.all[index]; if (control.req &#38;&#38; (control.Disabled != null)) { control.Disabled = true; } } } if you do not want to disable all the fields, the change the line [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=54&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is the code to disable all the fields on the form in CRM,</p>
<p><span style="white-space:pre;"> </span>if(crmForm.formtype != 1)</p>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span>for (var index in crmForm.all)</div>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span>var control = crmForm.all[index];</div>
<div><span style="white-space:pre;"> </span>if (control.req &amp;&amp; (control.Disabled != null))</div>
<div><span style="white-space:pre;"> </span>{</div>
<div><span style="white-space:pre;"> </span>control.Disabled = true;</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>}</div>
<div><span style="white-space:pre;"> </span>}</div>
<div></div>
<div>if you do not want to disable all the fields, the change the line</div>
<div></div>
<div><span style="white-space:pre;"> </span>if (control.req &amp;&amp; (control.Disabled != null))</div>
<div>to</div>
<div><span style="white-space:pre;"> </span>if (control.req &amp;&amp; (control.Disabled != null) &amp;&amp; (control.id != &#8216;attributename&#8217;))</div>
<div></div>
<div>Happy coding</div>
<div> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<br />Posted in Uncategorized  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/meghshyam.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/meghshyam.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/meghshyam.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/meghshyam.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/meghshyam.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/meghshyam.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/meghshyam.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/meghshyam.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=meghshyam.wordpress.com&amp;blog=9106099&amp;post=54&amp;subd=meghshyam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://meghshyam.wordpress.com/2009/09/01/disable-all-the-fields-on-the-form-in-crm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/962f2d409522f31d11df6c93b4843e30?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">meghshyam</media:title>
		</media:content>
	</item>
	</channel>
</rss>
