tag:blogger.com,1999:blog-943228120849381192024-02-18T21:29:46.972-08:00CRM Java ScriptsHere you will get all about CRM. like quick and efficient code.Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-94322812084938119.post-41791717382995124752016-12-25T01:51:00.000-08:002016-12-26T04:39:28.013-08:00Generate CRM organization service using service proxy<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to generate CRM organization service using service proxy ?</h2>
<div>
</div>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> This is my new post to generate organization service in CRM </span><span style="font-family: "verdana" , sans-serif;">2013,</span><span style="font-family: "verdana" , sans-serif;">2015 and 2016. Simplest method to generate dynamics CRM organization service,you can use below code for creting crm organisation service. For this you need to follow below instructions.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">For generation organization service below assemblies are required.</span><br />
<ol>
<li><b>Microsoft.Xrm.Sdk.dll</b></li>
<li><b>Microsoft.Crm.Sdk.Proxy.dll</b></li>
<li><b>System.configuration</b></li>
<li><b>System.ServiceModel</b></li>
</ol>
<span style="font-family: "verdana" , sans-serif;">And below name spaces will be required</span><br />
<ol>
<li><b>using Microsoft.Crm.Sdk.Messages;</b></li>
<li><b>using Microsoft.Xrm.Sdk;</b></li>
<li><b>using Microsoft.Xrm.Sdk.Client;</b></li>
<li><b>using System.ServiceModel.Description;</b></li>
</ol>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> Add below code in .cs file and App config file respectively. </span></span></div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1500px;">
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue; font-size: small;"><br /></span></span></span>
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue; font-size: small;"><b>//.CS File Code</b></span></span></span><br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">public static </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">IOrganizationService</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">GetCRMService()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">{</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> try</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">{</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;">// Get Ogranization Service Url</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">Uri </span><span style="font-family: "courier new" , "courier" , monospace;">oUri </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">= new </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">Uri</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">(</span><span style="font-family: "courier new" , "courier" , monospace;">System.Configuration.</span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">ConfigurationManager</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">.AppSettings["</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">OrganizationUrl</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"]);</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;">//Your credentials</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">ClientCredentials</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">clientCredentials </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">= new </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">ClientCredentials</span><span style="font-family: "courier new" , "courier" , monospace;">();</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">clientCredentials.UserName.UserName = System.Configuration.</span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">ConfigurationManager</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">.AppSettings[</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">"Username"</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">];</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">clientCredentials.UserName.Password = System.Configuration.</span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">ConfigurationManager</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">.AppSettings[</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">"Password"</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">];</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;">//Create your Organization Service Proxy</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">OrganizationServiceProxy </span><span style="font-family: "courier new" , "courier" , monospace;">_serviceProxy </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">= new </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">OrganizationServiceProxy</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">(</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">oUri,</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> null</span><span style="font-family: "courier new" , "courier" , monospace;">,</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">clientCredentials,</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> null</span><span style="font-family: "courier new" , "courier" , monospace;">);</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">_serviceProxy.EnableProxyTypes();</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"> IOrganizationService </span>service = _serviceProxy;</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;">// Obtain information about the logged on user from the web service.</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">Guid </span><span style="font-family: "courier new" , "courier" , monospace;">userId </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">= </span><span style="font-family: "courier new" , "courier" , monospace;">((</span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">WhoAmIResponse</span><span style="font-family: "courier new" , "courier" , monospace;">)</span><span style="font-family: "courier new" , "courier" , monospace;">_serviceProxy.Execute(</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">new </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">WhoAmIRequest</span><span style="font-family: "courier new" , "courier" , monospace;">())).UserId;</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> if </span><span style="font-family: "courier new" , "courier" , monospace;">(userId !=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> null</span><span style="font-family: "courier new" , "courier" , monospace;">)</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">{ </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">return </span><span style="font-family: "courier new" , "courier" , monospace;">service; }</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> else</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">{</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> return null</span><span style="font-family: "courier new" , "courier" , monospace;">; }</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> catch </span><span style="font-family: "courier new" , "courier" , monospace;">(</span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">Exception</span><span style="font-family: "courier new" , "courier" , monospace;">)</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">{</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> return null;</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">//App config file code</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><?</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">xml version=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"1.0"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> encoding=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"utf-8"?></span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">configuration</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> <appSettings</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;"><!--Organization Service Endpoint Address--></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">add key=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"OrganizationUrl"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> value=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"https://your organisation/XRMServices/2011/Organization.svc"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">/</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;"><!--UserName with domain--> </span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">add key=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"Username"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> value=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"username"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">/</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #6aa84f; font-family: "courier new" , "courier" , monospace;"> <!--password--> </span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">add key=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"Password"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> value=</span><span style="color: blue;"><span style="font-family: "courier new" , "courier" , monospace;">"password" /</span><span style="font-family: "courier new" , "courier" , monospace;">></span></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/appSettings</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">startup</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">supportedRuntime version=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"v4.0"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> sku=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">".NETFramework,Version=v4.5.2" /></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/startup</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">runtime</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">assemblyBinding xmlns=</span><span style="color: blue;"><span style="font-family: "courier new" , "courier" , monospace;">"urn:schemas-microsoft-com:asm.v1"</span><span style="font-family: "courier new" , "courier" , monospace;">></span></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">dependentAssembly</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">assemblyIdentity name=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"Microsoft.Xrm.Sdk"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> publicKeyToken=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"31bf3856ad364e35"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> culture=</span><span style="color: blue;"><span style="font-family: "courier new" , "courier" , monospace;">"neutral"</span><span style="font-family: "courier new" , "courier" , monospace;">/</span><span style="font-family: "courier new" , "courier" , monospace;">></span></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">bindingRedirect oldVersion=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"0.0.0.0-8.0.0.0"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> newVersion=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"8.0.0.0"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">/></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/dependentAssembly</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/assemblyBinding</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/runtime</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/configuration</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">></span></div>
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span>
</div>
<span style="background-color: white; color: #666666; font-family: "arial" , sans-serif; font-size: 13px;"><br /></span>
<span style="background-color: white;"><span style="color: #666666; font-family: "arial" , sans-serif; font-size: 13px;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span><span style="color: #666666; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;"> </span></span><br />
<span style="background-color: white;"><span style="color: #666666; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;">Please feel free to put comments for your queries.</span><span style="color: #666666; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;"></span><b style="color: #666666; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px;">Thanks.</b></span></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi, India28.6139391 77.20902120000005228.3907261 76.886297700000057 28.8371521 77.531744700000047tag:blogger.com,1999:blog-94322812084938119.post-66350154039809211712016-12-09T06:27:00.000-08:002016-12-09T06:32:29.184-08:00Generate Organization service using Microsoft.Xrm.Client dll<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to generate organization service using Microsoft.Xrm.Client dll ?</h2>
<div>
</div>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> This is my new post to generate organization service in CRM </span><span style="font-family: "verdana" , sans-serif;">2013,</span><span style="font-family: "verdana" , sans-serif;">2015 and 2016. Simplest method to generate organization service, for this only two line of C# code will be required.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">For generation organization service below assemblies are required.</span><br />
<ol>
<li><b>Microsoft.Xrm.Sdk.dll</b></li>
<li><b>Microsoft.Xrm.Client.dll</b></li>
<li><b>System.configuration</b></li>
</ol>
<span style="font-family: "verdana" , sans-serif;">And below name spaces will be required</span><br />
<ol>
<li><b>using Microsoft.Xrm.Client;</b></li>
<li><b>using Microsoft.Xrm.Client.Services;</b></li>
<li><b>using Microsoft.Xrm.Sdk;</b></li>
<li><b>using Microsoft.Xrm.Sdk.Client;</b></li>
<li><b>using Microsoft.Xrm.Sdk.Query;</b></li>
</ol>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> Add below code in .cs file and App config file respectively. </span></span></div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1500px;">
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue; font-size: small;"><br /></span></span></span>
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue; font-size: small;">//.CS File Code</span></span></span><br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">public </span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">IOrganizationService</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> getOrganizationService(</span><span style="color: cyan; font-family: "courier new" , "courier" , monospace;">string</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> key)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">{</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: cyan;">CrmConnection</span> con = <span style="color: blue;">new</span> CrmConnection(<span style="color: red;">"CRMOnline"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: cyan;">IOrganizationService</span> service = <span style="color: blue;">new</span> <span style="color: cyan;">OrganizationService</span>(con);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: cyan;">OrganizationServiceContext</span> Context = <span style="color: blue;">new</span> <span style="color: cyan;">OrganizationServiceContext</span>(service);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">return</span> service;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">//App config file code</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"><?xml version=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"1.0"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> encoding=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"utf-8"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> ?></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"><configuration></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> <startup></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> <supportedRuntime version = </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"v4.0"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> sku=</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">".NETFramework,Version=v4.5.2"</span><span style="color: red; font-family: "courier new" , "courier" , monospace;"> /></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </startup></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> <connectionStrings> </span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> <add name = </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">"CRMOnline" </span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #cc0000;">connectionString</span></span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">="Url=https://</span><b style="color: blue; font-family: "courier new", courier, monospace;"><u>Your Organization URL</u></b><span style="color: blue; font-family: "courier new" , "courier" , monospace;">/XRMServices/2011/Organization.svc; Username=xyz; Password=</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">xyz</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">password;"</span></span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> </connectionStrings></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"></configuration></span></div>
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span>
</div>
<span style="background-color: white; color: #666666; font-family: "arial" , sans-serif; font-size: 13px;"><br /></span>
<span style="background-color: white;"><span style="color: #666666; font-family: "arial" , sans-serif; font-size: 13px;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span><span style="color: #666666; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;"> </span></span><br />
<span style="background-color: white;"><span style="color: #666666; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;">Please feel free to put comments for your queries.</span><span style="color: #666666; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;"></span><b style="color: #666666; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px;">Thanks.</b></span></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0tag:blogger.com,1999:blog-94322812084938119.post-66458354292337644442016-09-18T01:13:00.001-07:002016-09-18T01:13:33.118-07:00Add a button on CRM 2016 form.<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to add a button in CRM 2015/2016 form ?</h2>
<div>
</div>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> This is my new post to add a new button in CRM 2015/2016.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">I can understand the CRM developers requirements, because after release of CRM roll up 12 and CRM 2013, we can access CRM on cross browsers also. when we did customization with java script functionality, It may vary browser to browser, so there may be need of yours to add a custom button in CRM 2013. So here is the simple java script code for CRM 2015/2016 and it will work in CRM 2011(rollup 12) as well as in CRM 2015/2016.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u></b> Add a attribute of type single line text on crm 2016 form. Or you may use existing one.</span> </span></div>
<br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><b><u>Step 2:- </u></b></span></span>Add the fallowing code to your crm java script web resource. And call this function on page load.</span><br />
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="margin-bottom: 0px; padding-left: 20px; width: 1500px;background-color: white;">
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue; font-size: small;"> </span></span></span><br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue; font-size: small;">function</span><span style="font-size: small;"> createButton(</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">atrname</span><span style="font-family: "courier new" , "courier" , monospace;">) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> <br /> if (
window.parent.document.getElementById(atrname ) != <span style="color: blue;">null</span>) {<br /> var fieldId = "<span style="color: red;">field</span>" + atrname ;<br /> if (
window.parent.document.getElementById(fieldId ) == <span style="color: blue;">null</span>) {<br /> <span style="color: blue;">var </span>elementId =
window.parent.document.getElementById(atrname + <span style="color: red;">"_d"</span>);<br /> <span style="color: blue;">var </span>div = document.createElement(<span style="color: red;">"div"</span>);<br /> div.style.width = <span style="color: red;">"100px"</span>;<br /> div.style.textAlign = <span style="color: red;">"right"</span>;<br /> div.style.display = <span style="color: red;">"inline"</span>;</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"> childDiv = elementId.getElementsByTagName(<span style="color: red;">'div'</span>)[0]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> childDiv.style.display = <span style="color: red;">"none"</span>;</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> elementId .appendChild(div, elementId );<br /> div.innerHTML =<span style="color: red;"> '<button id="' + fieldId + '" type="button" style="margin-left: 3px; width: 100%;" >Click Me !!</button>'</span>;<br />
window.parent.document.getElementById(atrname).style.width = <span style="color: red;">"0%"</span>;<br />
window.parent.document.getElementById(fieldId ).onclick = <span style="color: blue;">function </span>() { YourOnClickFunction(); };<br /> }<br /> }<br />}</span></div>
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span>
</div>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.3907261 76.886297700000057 28.8371521 77.531744700000047tag:blogger.com,1999:blog-94322812084938119.post-52568287551564443282016-08-04T12:40:00.000-07:002016-08-04T12:40:18.726-07:00How to get data from HTML web resource components to CRM 2016 form<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to get data from HTML web resource components to CRM 2016 form.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post, In this post I am going to tell how we can get data from html web resource to crm 2016 form events.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"> On CRM 2016 from if there is a html web resource placed in iframe and suppose you have text boxes and check boxes on html page and you want data from text boxes and check boxes on crm form events like on save or on field change events, we can get this data by using below java script code.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Below is a sample code in it we are reading data from check boxes on html page and after reading we can save that data on save event of crm 2016 form.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDvFFeJO_bzOhgb0OBUGMC2Ukw8cH79ankNGeYXgH7_p7GLfcEpONM2TsdQN9WdbniRN2BbasCDpLvI0eOWxwGjeZCfSzDpwCHIjfFNCK24L43fiVug8FQWDkVIKKAqXwJJ7sabVGzEBnz/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDvFFeJO_bzOhgb0OBUGMC2Ukw8cH79ankNGeYXgH7_p7GLfcEpONM2TsdQN9WdbniRN2BbasCDpLvI0eOWxwGjeZCfSzDpwCHIjfFNCK24L43fiVug8FQWDkVIKKAqXwJJ7sabVGzEBnz/s1600/Capture.PNG" /></a></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<div style="background-color: white;">
<br /></div>
<div style="background-color: white;">
<div style="background-color: white;">
<span style="color: blue; font-family: courier new, courier, monospace;">function </span><span style="font-family: courier new, courier, monospace;">readDataFromHTMLPage() {</span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: courier new, courier, monospace;"><br /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: courier new, courier, monospace;"> </span><span style="color: #38761d;"><span style="font-family: courier new, courier, monospace;">/</span><span style="font-family: "courier new", courier, monospace;">/Get web resource control</span></span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">var</span> webResCrtl = Xrm.Page.ui.controls.get(<span style="color: red;">"WebResource_TestWebPage"</span>);</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">if</span> (webResCrtl) {</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: #38761d;">//get web resource object</span></span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">var</span> webResObject = webResCrtl.getObject();</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">if</span> (webResObject) {</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: #38761d;">//Get HTML document</span></span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">var</span> htmlDocument = webResObject.contentWindow.document;</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">if</span> (htmlDocument) {</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: #38761d;">//Get all check boxes with class name "items"</span></span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">var</span> checkBoxes = htmlDocument.getElementsByClassName(<span style="color: red;">"items"</span>)</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">var</span> selectedIntractionCheckBoxes = <span style="color: red;">""</span>;</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">for</span> (var i = 0; i < checkBoxes.length; i++) {</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: #38761d;">//Get Selected check boxes</span></span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: blue;">if</span> (checkBoxes[i].childNodes[<span style="color: red;">'0'</span>].checked == true) {</span></div>
<span style="font-family: courier new, courier, monospace;"><span style="background-color: white;"> </span><span style="background-color: white;"><span style="color: blue;">if</span></span><span style="background-color: white;"> (selectedIntractionCheckBoxes == <span style="color: red;">""</span>)</span></span><br />
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> <span style="color: #38761d;">//write your logic to perform action</span></span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> selectedIntractionCheckBoxes = checkBoxes[i].textContent;</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> </span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> }</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> } </span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> }</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> }</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;"> }</span></div>
<div style="background-color: white;">
<span style="font-family: courier new, courier, monospace;">}</span></div>
</div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"></span><br /></div>
</div>
</div>
<br />
<br />
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. Good Luck .....!!!! Please feel free to leave comment.</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.3907261 76.886297700000057 28.8371521 77.531744700000047tag:blogger.com,1999:blog-94322812084938119.post-56521274150085508352016-08-02T11:52:00.000-07:002016-08-02T12:07:24.803-07:00How to import CRM 2016 solution to CRM 2015, Import solution from higher CRM to lower CRM version<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to import CRM 2016 solution to CRM 2015, Import solution from higher CRM to lower CRM version.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post, In this post I am going to to tell how we can import crm solution from higher to lower version, Obviously it is not recommended nor we required most of time, we rarely required but we do not know when could we in such a situation or we got a requirement ?</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">There are some set of instructions by which we can import solution from higher to lower version.</span><br />
<span style="font-family: "verdana" , sans-serif;">I am taking an example for importing CRM 2016 solution to CRM 2015.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Below are step by step instructions for importing CRM solution from higher CRM version to lower CRM version.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u> </b>Export solution from higher CRM version.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b style="text-decoration: underline;">Step 2:-</b> Open "solution" xml file in any xml editor and find below text.</span><br />
<br />
<ul>
<li><span style="font-family: "verdana" , sans-serif;">version</span></li>
<li><span style="font-family: "verdana" , sans-serif;">SolutionPackageVersion</span></li>
<li><span style="font-family: "verdana" , sans-serif;">behavior</span></li>
</ul>
<div>
<b style="font-family: verdana, sans-serif; text-decoration: underline;">Step 3:-</b><span style="font-family: "verdana" , sans-serif;"> Now change values for version and </span><span style="font-family: "verdana" , sans-serif;">SolutionPackageVersion and remove behavior="0", like below.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<span style="font-family: "verdana" , sans-serif;">Exported CRM solution file before change</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<span style="background-color: white; color: blue; font-family: "courier new" , "courier" , monospace;"><ImportExportXml </span><span style="background-color: yellow; color: blue; font-family: "courier new" , "courier" , monospace;">version="8.0.0001.0079"</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span style="background-color: yellow;"> SolutionPackageVersion="8.0"</span><span style="background-color: white;"> languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></span></span><br />
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <SolutionManifest></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UniqueName>Test</UniqueName></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedName description="Test" languagecode="1033" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Descriptions /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Version>1.0</Version></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Managed>0</Managed></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Publisher></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UniqueName>DefaultPublishermyninja</UniqueName></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedName description="Default Publisher for myninja" languagecode="1033" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Descriptions></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Description description="Default publisher for this organization" languagecode="1033" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Descriptions></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <EMailAddress xsi:nil="true"></EMailAddress></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <CustomizationPrefix>new</CustomizationPrefix></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <CustomizationOptionValuePrefix>10000</CustomizationOptionValuePrefix></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Addresses></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Address></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <AddressNumber>1</AddressNumber></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <AddressTypeCode xsi:nil="true"></AddressTypeCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <City xsi:nil="true"></City></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <County xsi:nil="true"></County></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Country xsi:nil="true"></Country></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Fax xsi:nil="true"></Fax></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <FreightTermsCode xsi:nil="true"></FreightTermsCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Latitude xsi:nil="true"></Latitude></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Line1 xsi:nil="true"></Line1></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Line2 xsi:nil="true"></Line2></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Line3 xsi:nil="true"></Line3></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Longitude xsi:nil="true"></Longitude></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Name xsi:nil="true"></Name></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <PostalCode xsi:nil="true"></PostalCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <PostOfficeBox xsi:nil="true"></PostOfficeBox></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <PrimaryContactName xsi:nil="true"></PrimaryContactName></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <ShippingMethodCode xsi:nil="true"></ShippingMethodCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <StateOrProvince xsi:nil="true"></StateOrProvince></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Telephone1 xsi:nil="true"></Telephone1></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Telephone2 xsi:nil="true"></Telephone2></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Telephone3 xsi:nil="true"></Telephone3></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UPSZone xsi:nil="true"></UPSZone></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UTCOffset xsi:nil="true"></UTCOffset></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Address></span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Addresses></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Publisher></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponents></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponent type="60" id="{028e1263-abec-4b11-8958-984195c8d2b3}" behavior="0" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponent type="60" id="{66c79877-1d08-4a33-8871-e5a95d666ff6}" behavior="0" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponent type="60" id="{814617a5-03aa-40c1-a6bf-c7c1176f4e65}" behavior="0" /></span></div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span style="background-color: white;"> <RootComponent type="91" schemaName="TestPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=928f120268c8daa4" </span><span style="background-color: yellow;">behavior="0"</span><span style="background-color: white;"> /></span></span><br />
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </RootComponents></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <MissingDependencies></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><MissingDependency></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Required key="4" type="1" schemaName="new_scans" displayName="Scans" solution="Active" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Dependent key="5" type="60" displayName="Information" parentDisplayName="Scans" id="{814617a5-03aa-40c1-a6bf-c7c1176f4e65}" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </MissingDependency></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"></MissingDependencies></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </SolutionManifest></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"></ImportExportXml></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"></span><br /></div>
</div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;">CRM solution file after change - <span style="background-color: yellow; color: blue; font-family: "courier new" , "courier" , monospace;">version </span>and <span style="background-color: yellow; color: blue; font-family: "courier new" , "courier" , monospace;">SolutionPackageVersion </span>changed from 8.0 to 7.0 and </span><span style="background-color: yellow; color: blue; font-family: "courier new" , "courier" , monospace;">behavior="0"</span><span style="font-family: "verdana" , sans-serif;"> has removed.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<span style="background-color: white; color: blue; font-family: "courier new" , "courier" , monospace;"><ImportExportXml </span><span style="background-color: yellow; color: blue; font-family: "courier new" , "courier" , monospace;">version="7.0.0001.0079"</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span style="background-color: yellow;"> SolutionPackageVersion="7.0"</span><span style="background-color: white;"> languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></span></span><br />
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <SolutionManifest></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UniqueName>Test</UniqueName></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedName description="Test" languagecode="1033" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Descriptions /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Version>1.0</Version></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Managed>0</Managed></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Publisher></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UniqueName>DefaultPublishermyninja</UniqueName></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <LocalizedName description="Default Publisher for myninja" languagecode="1033" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </LocalizedNames></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Descriptions></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Description description="Default publisher for this organization" languagecode="1033" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Descriptions></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <EMailAddress xsi:nil="true"></EMailAddress></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <CustomizationPrefix>new</CustomizationPrefix></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <CustomizationOptionValuePrefix>10000</CustomizationOptionValuePrefix></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Addresses></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Address></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <AddressNumber>1</AddressNumber></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <AddressTypeCode xsi:nil="true"></AddressTypeCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <City xsi:nil="true"></City></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <County xsi:nil="true"></County></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Country xsi:nil="true"></Country></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Fax xsi:nil="true"></Fax></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <FreightTermsCode xsi:nil="true"></FreightTermsCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Latitude xsi:nil="true"></Latitude></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Line1 xsi:nil="true"></Line1></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Line2 xsi:nil="true"></Line2></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Line3 xsi:nil="true"></Line3></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Longitude xsi:nil="true"></Longitude></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Name xsi:nil="true"></Name></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <PostalCode xsi:nil="true"></PostalCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <PostOfficeBox xsi:nil="true"></PostOfficeBox></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <PrimaryContactName xsi:nil="true"></PrimaryContactName></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <ShippingMethodCode xsi:nil="true"></ShippingMethodCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <StateOrProvince xsi:nil="true"></StateOrProvince></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Telephone1 xsi:nil="true"></Telephone1></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Telephone2 xsi:nil="true"></Telephone2></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Telephone3 xsi:nil="true"></Telephone3></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UPSZone xsi:nil="true"></UPSZone></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UTCOffset xsi:nil="true"></UTCOffset></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Address></span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Addresses></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </Publisher></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponents></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponent type="60" id="{028e1263-abec-4b11-8958-984195c8d2b3}" behavior="0" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponent type="60" id="{66c79877-1d08-4a33-8871-e5a95d666ff6}" behavior="0" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <RootComponent type="60" id="{814617a5-03aa-40c1-a6bf-c7c1176f4e65}" behavior="0" /></span></div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span style="background-color: white;"> <RootComponent type="91" schemaName="TestPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=928f120268c8daa4"</span><span style="background-color: white;"> /></span></span><br />
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </RootComponents></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <MissingDependencies></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"><MissingDependency></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Required key="4" type="1" schemaName="new_scans" displayName="Scans" solution="Active" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> <Dependent key="5" type="60" displayName="Information" parentDisplayName="Scans" id="{814617a5-03aa-40c1-a6bf-c7c1176f4e65}" /></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </MissingDependency></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"></MissingDependencies></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </SolutionManifest></span></div>
<div style="background-color: white;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"></ImportExportXml></span></div>
</div>
</div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b style="text-align: justify; text-decoration: underline;">Step 3:-</b><span style="text-align: justify;"> Now save solution.xml file and compress using only windows compression not with any other compress tool and then import solution to version 7.0 (CRM 2015), I am sure it will be imported successfully.</span></span><br />
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<b style="font-family: verdana, sans-serif;">Note:-</b><span style="font-family: "verdana" , sans-serif;"> <u>this is not supported way and not recommended by Microsoft. Most of time it works but it may not work properly, it also depends on your crm customization. If your crm solution contains minimal customization then chances are higher to work properly.</u></span></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. Good Luck .....!!!! Please feel free to leave comment.</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.3907261 76.886297700000057 28.8371521 77.531744700000047tag:blogger.com,1999:blog-94322812084938119.post-54496520810868382292016-08-01T12:05:00.000-07:002016-08-16T11:29:28.844-07:00Update record in crm 2016 using crm web api with java script <div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Retrieve record in CRM 2016 using CRM web API with java script.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post, In this post I am going to to tell how to update record in dynamics CRM 2016 using CRM web API.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In new CRM 2016 release there is a new way introduced for operation like create, update, delete,retrieve, multiple retrieve etc, web API. Web API has been introduced so that communication between CRM and and other platform application can be done easily. New CRM web API is fully supports JSON format.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Below is the sample java script code for retrieving record in CRM using java script.</span></div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><br /></span></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">function</span> update() {<br />
<span style="color: blue;">var</span> clientURL = Xrm.Page.context.getClientUrl();<br />
<span style="color: blue;">var</span> req = <span style="color: blue;">new</span> XMLHttpRequest()<br />
<span style="color: blue;">var</span> query = <span style="color: sienna;">"/api/data/v8.0/accounts(5AC84B7C-4D57-E611-80DC-705A0F235AE3)"</span>;<br />
req.open(<span style="color: sienna;">"PATCH"</span>, encodeURI(clientURL + query), <span style="color: blue;">true</span>);<br />
req.setRequestHeader(<span style="color: sienna;">"Accept"</span>, <span style="color: sienna;">"application/json"</span>);<br />
req.setRequestHeader(<span style="color: sienna;">"Content-Type"</span>, <span style="color: sienna;">"application/json;charset=utf-8"</span>);<br />
req.setRequestHeader(<span style="color: sienna;">"OData-MaxVersion"</span>, <span style="color: sienna;">"4.0"</span>);<br />
req.setRequestHeader(<span style="color: sienna;">"OData-Version"</span>, <span style="color: sienna;">"4.0"</span>);<br />
req.onreadystatechange = <span style="color: blue;">function</span> () {<br />
<span style="color: blue;">if</span> (<span style="color: blue;">this</span>.readyState == <span style="color: darkblue;">4</span>) {<br />
req.onreadystatechange = <span style="color: blue;">null</span>;<br />
<span style="color: blue;">if</span> (<span style="color: blue;">this</span>.status == <span style="color: darkblue;">204</span>) {<br />
alert(<span style="color: sienna;">"Success"</span>);<br />
}<br />
<span style="color: blue;">else</span> {<br />
<span style="color: blue;">var</span> error = JSON.parse(<span style="color: blue;">this</span>.response).error;<br />
alert(<span style="color: sienna;">"Error deleting Account – "</span> + error.message);<br />
}<br />
}<br />
};<br />
<br />
<span style="color: green;">//Create object of entity</span><br />
<span style="color: blue;">var</span> account = <span style="color: blue;">new</span> <span style="color: blue;">Object</span>();<br />
<span style="color: green;">//String Field</span><br />
account.name = <span style="color: sienna;">"Test Neo"</span>;<br />
<span style="color: green;">//Option Set field</span><br />
account.ownershipcode = <span style="color: darkblue;">1</span>;<br />
<span style="color: green;">//Two option</span><br />
account.donotemail = <span style="color: blue;">true</span>;<br />
<span style="color: green;">//Currency</span><br />
account.creditlimit = <span style="color: darkblue;">12345</span>;<br />
<span style="color: green;">//Whole number</span><br />
account.numberofemployees = <span style="color: darkblue;">28</span>;<br />
<span style="color: green;">//Lookup</span><br />
account[<span style="color: sienna;">"primarycontactid@odata.bind"</span>] = <span style="color: sienna;">"/contacts(7166DE85-1858-E611-80DD-705A0F235AE3)"</span><br />
<br />
req.send(JSON.stringify(account));<br />
}</span></div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. Good Luck .....!!!!</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.3907261 76.886297700000057 28.8371521 77.531744700000047tag:blogger.com,1999:blog-94322812084938119.post-58454657546921500702016-07-31T11:58:00.000-07:002016-08-16T11:28:11.359-07:00Delete record in CRM 2016 using crm web api with java script <div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Retrieve record in CRM 2016 using CRM web API with java script.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post, In this post I am going to to tell how to delete record in dynamics CRM 2016 using CRM web API.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In new CRM 2016 release there is a new way introduced for operation like create, update, delete,retrieve, multiple retrieve etc, using web API. Web API has been introduced so that communication between CRM and and other platform application can be done easily. New CRM web API is fully supports JSON format.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Below is the sample java script code for retrieving record in CRM using java script.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">function </span>deleteRecord() { </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>clientURL = Xrm.Page.context.getClientUrl();</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>req = <span style="color: blue;">new </span>XMLHttpRequest()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>query = </span><span style="color: red; font-family: "courier new" , "courier" , monospace;">"/api/data/v8.0/accounts(00000000-0000-0000-0000-000000000000)</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">";</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.open("Delete", encodeURI(clientURL + </span><span style="font-family: "courier new" , "courier" , monospace;">query</span><span style="font-family: "courier new" , "courier" , monospace;">), </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">true</span><span style="font-family: "courier new" , "courier" , monospace;">); </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"Accept", "application/json"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"Content-Type", "application/json;charset=utf-8"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"OData-MaxVersion", "4.0"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"OData-Version", "4.0"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.onreadystatechange = <span style="color: blue;">function </span>() {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">if </span>(<span style="color: blue;">this</span>.readyState == 4) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.onreadystatechange = <span style="color: blue;">null</span>;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">if </span>(<span style="color: blue;">this</span>.status == 204) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">alert(</span><span style="color: red; font-family: "courier new" , "courier" , monospace;">"Success"</span><span style="font-family: "courier new" , "courier" , monospace;">);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">else </span>{</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>error = JSON.parse(<span style="color: blue;">this</span>.response).error;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> alert(<span style="color: red;">"Error deleting Account – "</span> + error.message);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> };</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.send(<span style="color: blue;">null</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
</div>
<br />
<br />
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. Good Luck .....!!!!</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.3907261 76.886297700000057 28.8371521 77.531744700000047tag:blogger.com,1999:blog-94322812084938119.post-10921884820547643922016-03-06T21:03:00.001-08:002016-08-01T12:18:42.002-07:00Retrieve record in CRM 2016 using CRM web API with java script<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Retrieve record in CRM 2016 using CRM web API with java script.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post, In this post I am going to to tell how to retrieve record in dynamics CRM 2016 using CRM web API.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In new CRM 2016 release there is a new way introduced for operation like create, update, delete,retrieve, multiple retrieve etc, web API. CRM Organization service is going to obsolete in this CRM by Microsoft. Web API has been introduced so that communication between CRM and and other platform application can be done easily. New CRM web API is fully support JSON format.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Below is the sample java script code for retrieving record in CRM using java script.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">function </span>retrieveRecord() { </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>clientURL = Xrm.Page.context.getClientUrl();</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>req = <span style="color: blue;">new </span>XMLHttpRequest()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>query = </span><span style="color: red; font-family: "courier new" , "courier" , monospace;">"/api/data/v8.0/accounts?$select=name&$top=1";</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.open("GET", encodeURI(clientURL + </span><span style="font-family: "courier new" , "courier" , monospace;">query</span><span style="font-family: "courier new" , "courier" , monospace;">), </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">true</span><span style="font-family: "courier new" , "courier" , monospace;">); </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"Accept", "application/json"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"Content-Type", "application/json;charset=utf-8"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"OData-MaxVersion", "4.0"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"OData-Version", "4.0"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.onreadystatechange = <span style="color: blue;">function </span>() {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">if </span>(<span style="color: blue;">this</span>.readyState == 4) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.onreadystatechange = <span style="color: blue;">null</span>;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">if </span>(<span style="color: blue;">this</span>.status == 200) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>data = JSON.parse(this.response);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">if </span>(data && data.value) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">for </span>(<span style="color: blue;">var </span>indxAccounts = 0; indxAccounts < data.value.length; indxAccounts++) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>accountName = data.value[indxAccounts].name;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>eTag = data.value[indxAccounts][<span style="color: red;">'@odata.etag'</span>];</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">else </span>{</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>error = JSON.parse(<span style="color: blue;">this</span>.response).error;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> alert(<span style="color: red;">"Error retrieving Accounts – "</span> + error.message);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> };</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.send(<span style="color: blue;">null</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;">Only query will change for different type of retrieve. Below are the different retrieve queries.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">1. Retrieve top 1 record</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="background-color: white; font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span>query = </span><span style="background-color: white; color: red; font-family: "courier new" , "courier" , monospace;">"/api/data/v8.0/accounts?$select=name&$top=1"</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;">2. Retrieve records with lookup condition like records owned bay a user.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="background-color: white;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span>query = </span><span style="color: red; font-family: "courier new" , "courier" , monospace;">"</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">/api/data/v8.0/accounts? $select=name,accountnumber,_primarycontactid_value,createdon,accountcategorycode,revenue&$filter=_ownerid_value eq (212626EE-54B9-4E99-93F9-0BF5FDCA3481)"</span></span></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">3. Retrieve accounts whose name starts with B or C.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="background-color: white;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;">var </span><span style="font-family: "courier new" , "courier" , monospace;">query =<span style="color: red;">"</span></span><span style="color: red; font-family: "courier new" , "courier" , monospace;">accounts?$filter=startswith(name,'B') or startswith(name,'C')"</span></span><br />
<span style="color: red; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">4. Retrieve related entity attributes.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="background-color: white;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;">var </span><span style="font-family: "courier new" , "courier" , monospace;">query =<span style="color: red;">"</span></span><span style="color: red; font-family: "courier new" , "courier" , monospace;">/api/data/v8.0/accounts(B14CC863-07E3-E511-80EE-3863BB2E4DE0)?$select=name,accountnumber,_primarycontactid_value,createdon,accountcategorycode,revenue&$orderby=name&$expand=primarycontactid($select=fullname,telephone1,email)"</span><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. Good Luck .....!!!!</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com1New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.1680166 76.563574200000048 29.059861599999998 77.854468200000056tag:blogger.com,1999:blog-94322812084938119.post-5789461773053685112016-03-05T11:34:00.000-08:002016-08-01T12:20:02.314-07:00Create record in CRM 2016 using CRM web API with java script.<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Create record in CRM 2016 using web API with java script.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post, In this post I am going to to tell how to create record in dynamics CRM 2016 using CRM web API.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In new CRM 2016 release there is a new way introduced for operation like create, update, delete,retrieve, multiple retrieve etc, web API. CRM Organization service is going to obsolete in this CRM by Microsoft. Web API has been introduced so that communication between CRM and and other platform application can be done easily. New CRM web API is fully support JSON format.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Below is the sample java script code for creating the record in CRM using java script.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
<br />
<div align="left" style="margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; margin-bottom: 0px; padding-left: 20px; width: 1000px;">
<span lang="EN-US"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">function</span> cerateRecord(</span><span style="font-family: "courier new" , "courier" , monospace;">clientURL</span><span style="font-family: "courier new" , "courier" , monospace;">)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">{ </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><span style="color: #38761d;"><span style="font-family: "courier new" , "courier" , monospace;">//</span><span style="font-family: "courier new" , "courier" , monospace;">clientURL = your CRM organization URL.</span></span><span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var</span> req = new XMLHttpRequest()</span><span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.open(<span style="color: red;">"POST"</span>, encodeURI(clientURL + <span style="color: red;">"/api/data/v8.0/accounts"</span>), <span style="color: blue;">true</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"Accept", "application/json"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"Content-Type", "application/json;charset=utf-8"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"OData-MaxVersion", "4.0"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.setRequestHeader(<span style="color: red;">"OData-Version", "4.0"</span>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.onreadystatechange = <span style="color: blue;">function</span> () {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">if</span> (<span style="color: blue;">this</span>.readyState == 4 <span style="color: #38761d;">/* complete */</span>) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> req.onreadystatechange = null;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> if (<span style="color: blue;">this</span>.status == 204) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>accountUri = <span style="color: blue;">this</span>.getResponseHeader(<span style="color: red;">"OData-EntityId"</span>);</span><span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">else </span>{</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>error = JSON.parse(<span style="color: blue;">this</span>.response).error;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> };</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>account = <span style="color: blue;">new </span>Object();</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: #38761d;">//String Field</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> account.name = <span style="color: red;">"Test Neo"</span>;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: #38761d;"> //Option Set field</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> account.ownershipcode = 1;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: #38761d;">//Two option</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> account.donotemail = <span style="color: blue;">true</span>;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: #38761d;">//Currency</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> account.creditlimit = 12345;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: #38761d;">//Whole number</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> account.numberofemployees = 28;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: #38761d;">//Lookup</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> account[<span style="color: red;">"primarycontactid@odata.bind"</span>] = <span style="color: red;">"/contacts(C8944807-EFD9-E511-80EC-3863BB2E4DE0)"</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue;">var </span>response = req.send(JSON.stringify(account));</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. Good Luck .....!!!!</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.1680166 76.563574200000048 29.059861599999998 77.854468200000056tag:blogger.com,1999:blog-94322812084938119.post-77133788312048376852016-02-28T03:52:00.000-08:002016-03-06T03:27:35.548-08:00How to integrate Lync or Skype with CRM 2016<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
How to integrate Lync or Skype with CRM 2016.</h2>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;">Here is my new post, I am going to tell how to integrate Lync or Skype in dynamics CRM 2016 it works for CRM online and CRM on premise as well. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In todays business scenario there are many requirements like if you click on any phone number inside CRM application a call should go automatically to that phone number using Lync or Skype.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">So Microsoft provided it as a inbuilt functionality in Dynamics CRM 2016. We just need to do some settings in CRM application, It is easy we do these setting through UI. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Software Requirements </span><br />
<span style="font-family: "verdana" , sans-serif;">The CRM Organization or client must have one of the following subscriptions. Skype for Business. </span><br />
<span style="font-family: "verdana" , sans-serif;">Skype for Business Server 2015. </span><br />
<span style="font-family: "verdana" , sans-serif;">Microsoft Lync Server 2013. </span><br />
<span style="font-family: "verdana" , sans-serif;">Microsoft Lync Server 2010.</span><br />
<span style="font-family: "verdana";"><span style="color: black; font-family: "verdana"; font-size: 13.5000pt;"><span style="font-size: small;"></span></span></span><br />
<div class="p0" style="margin-bottom: 0pt; margin-left: 21.0000pt; margin-top: 0pt; mso-list: l0 level1 lfo1; text-indent: -21.0000pt;">
<span style="font-family: "verdana";"><span style="color: black; font-family: "verdana"; font-size: 13.5000pt;"><span style="font-size: small;"><span style="font-family: "verdana"; font-size: 12.0000pt;"><br /></span></span></span></span></div>
<span style="font-family: "verdana";"><span style="color: black; font-family: "verdana"; font-size: 13.5000pt;"><span style="font-size: small;">
</span></span></span>
<span style="font-family: "verdana" , sans-serif;">Below are the steps for settings.</span><span style="font-family: "verdana" , sans-serif;"><br /></span><br />
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 1:- First go to system settings in CRM by following steps in below image.</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p><br /></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEnUf4KZtGEqZfnWMVZ2ETI9uK7x4TqXksic68tIATbxMEcfzcShTvNi_BJckOGqDdp1sVzWY_nj8CfOsh5ExtFrQp56BLIrnya1s3RVHYHC4jFanX8KIuSifch61R1OXcHbzxRn-mstNh/s1600/LyncIntegration1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="281" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEnUf4KZtGEqZfnWMVZ2ETI9uK7x4TqXksic68tIATbxMEcfzcShTvNi_BJckOGqDdp1sVzWY_nj8CfOsh5ExtFrQp56BLIrnya1s3RVHYHC4jFanX8KIuSifch61R1OXcHbzxRn-mstNh/s640/LyncIntegration1.jpg" width="640" /></a></div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihXjhCYz2zBeXke4Xu821W0idIHzbB3X6c2lnGtduDcFDMmcxu96eGAybmoQBkdJX0ulWsxUOe-GS1cIPVWQRK6OOtaRKpXjBq-gMou-cB8iCP-cK0a3kIDPrhk_vPJEgg5xJliQfDM_H0/s1600/lyncintegration2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihXjhCYz2zBeXke4Xu821W0idIHzbB3X6c2lnGtduDcFDMmcxu96eGAybmoQBkdJX0ulWsxUOe-GS1cIPVWQRK6OOtaRKpXjBq-gMou-cB8iCP-cK0a3kIDPrhk_vPJEgg5xJliQfDM_H0/s1600/lyncintegration2.jpg" /></a></div>
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 2- Now set the below options.</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"> </span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivb8J-lQ0qZV3gW1YyAiwiPwOc8EyKKq7TcGfQz2_xVdds66QCROCs68FvgxCyak2FSqT5SjIbYklai-yAoMGtpWxVtbIw1Dqdsrp6skxlK4qoRi1qcXMFp2vO0kvPQZrZX1i-Vs7TYGtj/s1600/lyncintegration3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivb8J-lQ0qZV3gW1YyAiwiPwOc8EyKKq7TcGfQz2_xVdds66QCROCs68FvgxCyak2FSqT5SjIbYklai-yAoMGtpWxVtbIw1Dqdsrp6skxlK4qoRi1qcXMFp2vO0kvPQZrZX1i-Vs7TYGtj/s1600/lyncintegration3.jpg" /></a></span></div>
<span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"></span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p><br /></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "verdana" , sans-serif;">Now open any CRM record which has phone number field and click on phone number a popup will open and automatic call will go to that number by Lync or Skype. Like below image.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTdEgT2aI5ainciMfJ3Eb5UeBLwiVxyCkcJvbCUAfjfUTRgwNL4NKMu7uR6bJ81E0eJoPWYkXe8dBQi0DjYExPJ27T6dMijoP5O59LMJw_MWGZftL85YGBq-Crm4PJLAnvrnDG_nrqrMP4/s1600/2016-02-28_17-14-19.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTdEgT2aI5ainciMfJ3Eb5UeBLwiVxyCkcJvbCUAfjfUTRgwNL4NKMu7uR6bJ81E0eJoPWYkXe8dBQi0DjYExPJ27T6dMijoP5O59LMJw_MWGZftL85YGBq-Crm4PJLAnvrnDG_nrqrMP4/s1600/2016-02-28_17-14-19.jpg" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-family: "verdana";"><br /></span><span style="font-family: "verdana";"><br /></span><br />
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM.</span> </div>
</div>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.1680166 76.563574200000048 29.059861599999998 77.854468200000056tag:blogger.com,1999:blog-94322812084938119.post-29355379344608881372016-02-23T08:55:00.000-08:002016-02-29T09:54:16.075-08:00How to update or set custom values for status code in CRM 2011/CRM 2013/CRM 2015 and CRM 2016 from UI<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
How to update or set custom values for status code in CRM 2011/2013/2015 and 2016.</h2>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;">Here is my new post, I am going to tell how to update or set custom values to status code in dynamics crm, it works for CRM online and CRM on-premise as well for all versions CRM 2011, CRM 2013, CRM 2015 and CRM 2016 .</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"> As there is no supported way by which we can update values for status code option. But I found a way by which we can update these values.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 1:- Export solution with entity in which you want to update status code option set value.</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri";"><span style="font-size: 11pt;">Step 2:- Open </span><span style="font-size: 14.6667px;">customization.xml</span><span style="font-size: 11pt;"> file in visual studio or in any other XML editor.</span></span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 3:- Search entity under <Entities> and <Entity> node in which you want to update status code. </span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-UXrzO6qTBDW9jWJOHOYAdj6pYHKiqV_5H66p2dIIpl7Ts4jM22ceRXXFpuNmw_XEFrxMJxPI8kU2ei22JVCW5hgO2cJCBneQyxkXwoSKVZ-xA8eY6whHOW80ifLCp2f3-JnQNgcA2QCt/s1600/Untitled1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-UXrzO6qTBDW9jWJOHOYAdj6pYHKiqV_5H66p2dIIpl7Ts4jM22ceRXXFpuNmw_XEFrxMJxPI8kU2ei22JVCW5hgO2cJCBneQyxkXwoSKVZ-xA8eY6whHOW80ifLCp2f3-JnQNgcA2QCt/s1600/Untitled1.jpg" /></a></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 4:- Now find status code attribute under <attributes> node. As shown in below image.</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0cNAT7vxRPEAMSKicmrWo8wkwkEH6OXCK_EwyyM-6V4irars0svlgX_gMTixcAKjR7abMYKFJ3kAwD3l2FX_QqvBddiMZ6HaV4M_Diw__HkWUY_of1bs1CyWJ8X1u7cb7Hl7RrvquSani/s1600/Untitled2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0cNAT7vxRPEAMSKicmrWo8wkwkEH6OXCK_EwyyM-6V4irars0svlgX_gMTixcAKjR7abMYKFJ3kAwD3l2FX_QqvBddiMZ6HaV4M_Diw__HkWUY_of1bs1CyWJ8X1u7cb7Hl7RrvquSani/s1600/Untitled2.jpg" /></a></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"> </span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 5:- Update values of status code as you required.</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"> </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-3GJvOHh_UQ_BWT2OrbktK1PpRQ0t94YwxDWrlCV6u-78lLDStGUK9gopupm9lzVV9GQ-2ykyD0I8L2FwEznoYj2KcfXfmoU4q7t_V-TrTbvb5DZo4-A0-7MlSKDjBRJDm1mewWh5Wqza/s1600/Untitled3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-3GJvOHh_UQ_BWT2OrbktK1PpRQ0t94YwxDWrlCV6u-78lLDStGUK9gopupm9lzVV9GQ-2ykyD0I8L2FwEznoYj2KcfXfmoU4q7t_V-TrTbvb5DZo4-A0-7MlSKDjBRJDm1mewWh5Wqza/s1600/Untitled3.jpg" /></a></div>
<br />
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 6:- Now save xml file and send to compress zip folder (do not use any other third party compress tool use windows compress feature).</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;"> </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLDlSYZeQCvPfbDyy0GzFKR6rd47AkuKMxkz1OQfpM5F3PAWkluGN9zqClnZSOGnTL7YXrLzJVOUp1v6jKo7iD0Vag0ydAXfjZSIbsbeO7rhKZXQil4ybvsECpfiSkQsIbCLhvQTEtgL1r/s1600/Untitled4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLDlSYZeQCvPfbDyy0GzFKR6rd47AkuKMxkz1OQfpM5F3PAWkluGN9zqClnZSOGnTL7YXrLzJVOUp1v6jKo7iD0Vag0ydAXfjZSIbsbeO7rhKZXQil4ybvsECpfiSkQsIbCLhvQTEtgL1r/s1600/Untitled4.jpg" /></a></div>
<br />
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Step 7:- Import solution back to CRM organization and do publish all and check status code value, you will get new values.</span><span style="font-family: "calibri"; font-size: 11.0000pt;"><o:p></o:p></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri"; font-size: 11.0000pt;">Please note this is not supported customization and Microsoft does not recommends it.</span></div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM.</span>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi 110001, India28.6139391 77.20902120000005228.6139391 77.209021200000052 28.6139391 77.209021200000052tag:blogger.com,1999:blog-94322812084938119.post-66398525914197754452014-07-27T05:33:00.000-07:002016-02-23T08:59:26.535-08:00current fiscal year in crm 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
How to get current fiscal year in CRM 2013.</h2>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;">Here is my new post, In this post you can get current fiscal year according to the settings in CRM.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"> There is no as such function in CRM 2011 nor in CRM 2013 which can retrieve current fiscal year directly. we need to write our custom function in java script or in plugin or in custom workflow for getting current fiscal year.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Below is the procedure for getting current fiscal year in CRM.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><u><b>Step 1:-</b></u> The first step is that you have to retrieve "fiscalyearstart" (Fiscal year start date from "</span><span style="font-family: "verdana" , sans-serif;">organization" entity).</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;">Now use this function to calculate current fiscal year.</span><br />
<br />
<span style="font-size: small;"><b><span style="font-family: "verdana" , sans-serif;"> Function for plugin or custom workflow.</span></b></span></div>
<hr />
<div align="left" style="height: 250px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 600px; margin-bottom: 0px; width: 1000px;">
<span style="font-size: x-small;"><b> </b></span><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> <span style="color: blue;">public int</span> getCurrentFiscalYear(</span></b><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="color: #3d85c6;">DateTime <span style="color: black;">fiscalcalendarstartdate</span></span></span></b>)<br /> {<br /> <span style="color: blue;">int </span>currentFiscalYear;</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> //fiscalcalendarstart is date which you have to retrieve from organization entity<br /> <span style="color: #3d85c6;">DateTime </span>sDate = </span></b><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="color: #3d85c6;"><span style="color: black;">fiscalcalendarstartdate</span></span></span></b></span></b><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">;<br /> </span></b><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="color: #3d85c6;">DateTime </span></span></b>currentDate = System.</span></b><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="color: #3d85c6;">DateTime</span></span></b>.Now;<br /><br /> <span style="color: blue;">if </span>(sDate < currentDate)<br /> {<br /> <span style="color: blue;">int </span>diff = currentDate.Year - sDate.Year;<br /> currentFiscalYear = sDate.Year + diff;<br /> }<br /> <span style="color: blue;">else</span><br /> {<br /> <span style="color: blue;">int </span>diff = sDate.Year - currentDate.Year;<br /> <span style="color: blue;">if </span>(diff == 0)<br /> currentFiscalYear = sDate.Year + 1;<br /><br /> <span style="color: blue;">else</span><br /> currentFiscalYear = sDate.Year - diff;<br /> }<br /><br /> <span style="color: blue;">return </span>currentFiscalYear<br /> }</span></b></div>
</div>
<hr />
<br />
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-size: small;"><b><span style="font-family: "verdana" , sans-serif;"> Function for java script.</span></b></span><br />
<hr />
<div align="left" style="height: 260px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 590px; margin-bottom: 0px; width: 1100px;">
<span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">function </span>getCurrentFiscalYear(fiscalcalendarstart) {<br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span></span></span>CurrentFiscalYear;<br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">//fiscalcalendarstart is date which you have to retrieve from organization entity </span></span>//Organisation Fiscal start date<br /> <span style="color: blue;">var </span>sDate = new Date(fiscalcalendarstart);<br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var <span style="color: black;">today</span></span></span></span> <span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">= new Date()</span></span>;<br />
<span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span></span></span><span style="font-family: "courier new" , "courier" , monospace;">todayDate = today.getMonth() + 1 + "/" + today.getDate() + "/" + today.getFullYear();</span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span style="font-size: small;"></span></span><br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span></span></span>currentDate = new Date(todayDate);<br /><br /> <span style="color: blue;">if </span>(startDate <= todayDate) {<br /><br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span></span></span>diff = currentDate.getFullYear() - sDate.getFullYear();<br /><br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"></span></span></span>CurrentFiscalYear = (parseInt(sDate.getFullYear()) + parseInt(diff));<br /><br /> }<br /> <span style="color: blue;">else </span>{<br /><br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var </span></span></span>diff = sDate.getFullYear() - currentDate.getFullYear();<br /><br /> <span style="color: blue;">if </span>(parseInt(diff) == 0) {<br /><br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"></span></span></span>CurrentFiscalYear = (parseInt(sDate.getFullYear()) - parseInt(1));<br /><br /> }<br /> <span style="color: blue;">else </span>{<br /> </span></span><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"></span></span></span>CurrentFiscalYear = (parseInt(sDate.getFullYear()) - parseInt(diff));<br /> } <br /> } <br />}</span></span></div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;">For details visit this post.</span><br />
<span style="font-family: "verdana" , sans-serif;"><a href="http://crmjavascripts.blogspot.com/2013/06/current-fiscal-year-in-crm-2011.html" target="_blank">http://crmjavascripts.blogspot.com/2013/06/current-fiscal-year-in-crm-2011.html</a></span><br />
<br />
<br />
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM.</span>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi, India28.635308 77.2249600000000128.1893855 76.579513 29.081230499999997 77.870407000000014tag:blogger.com,1999:blog-94322812084938119.post-36510281385267406922014-04-20T05:43:00.000-07:002016-02-23T09:00:21.744-08:00How to increase the performance of crm form<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">Hello CRM Lovers,</span></span><br />
<div style="text-align: justify;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"> </span></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"> Many times we see that crm form takes much time to load, this is really hectic. Every one wants smooth processing of crm. So we have to take care of the thing by which crm perform well.</span></span><br />
<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"> Slow processing may be due to fallowing reasons, slow internet, less ram and java scripts on crm form. Improper java scripts code is also a bigger reason for slow processing of crm form.</span></span><br />
<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"> In this post of mine I am going to describe about best practices for use of java script code.</span></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"><br /></span></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">These are some things you should remember before using java script on crm form.</span></span><br />
<h2>
<span style="font-size: large;"><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><b>1. Do not include unnecessary java script web resource library :-</b></span></span></h2>
<dl><dd><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">As we know if any web page contains more script to include on page load, page will take more time to load, so the more scripts you add to the form, the more time it will take to download them. After loading first time scripts get cached in browser. But as we usually say first impression is the last impression, so we have to try to not include unnecessary web resource library on crm form.<br /><br />For a example, don’t include jQuery in your form scripts simply because if you want to use XMLHttpRequests. While jQuery has the $.ajax function that many people are familiar with to perform these requests, it is a developer preference, not a necessity. It is possible and better also to perform these requests using the native XMLHttpRequest object found in all browsers supported by Microsoft Dynamics CRM. </span></span></dd></dl>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"></span></span></div>
<div style="text-align: justify;">
<h2>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"><b>2. Try to avoid loading all scripts in the Onload eventof the crm form</b> :-</span></span></h2>
<dl><dd><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">If you have code that only supports OnChange events for fields or the
OnSave event, make sure to set the script library with the event handler
for those events instead of the OnLoad event. This way loading those
libraries can be deferred and increase performance when the form loads.
We do not recommend using the<b> </b>addOnChange
method within the OnLoad event handler simply as a matter of convenience.
While this may reduce the number of steps necessary to add your event handlers,
it causes the form to load more slowly.</span></span></dd></dl>
<h2>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"><b>3. Use collapsed tabs to defer loading web resources</b> :-</span></span></h2>
<dl><dd><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">Here is one intresting thing whenever a web resources or IFRAMES are included in sections inside a collapsed
tab, they will not be loaded if the tab is collapsed so the script will also not get loded on page load. They will be loaded when
the tab is expanded. When the tab state changes, the TabStateChange event
occurs. Any code that is required to support web resources or IFRAMEs within
collapsed tabs can use event handlers for the TabStateChange event and
reduce code that might otherwise have to occur in the OnLoad event. So we we have to think and decide which code should written on Onload event of the crm form.</span></span></dd></dl>
<h2>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;"><b>4. Try to set default visibility options</b> :-</span></span></h2>
<dl><dd><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">We have to use default functionality for hiding attributes, We should avoid to use form scripts in the OnLoad event to hide form elements.
Instead, set the default visibility options for form elements that might be
hidden to not be visible by default when the form loads. Then, use scripts in
the OnLoad event to show those form elements you want to display. </span></span></dd></dl>
</div>
<hr />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-size: large;">Enjoy the great technology Dynamics CRM. </span><span style="font-size: large;">Good luck.</span></span><br />
<hr />
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0tag:blogger.com,1999:blog-94322812084938119.post-695320623149503302014-04-19T14:23:00.001-07:002016-02-23T09:28:37.931-08:00How to filter lookup in crm 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
How filter lookup in CRM 2013.</h2>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;">After release of CRM 2013 we got many new features in CRM. First is that performance increases of crm. There are various changes in java script functions for increasing performance of crm.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"> Here is my new post with the new java scripts in crm 2013 for filtering lookup. In CRM 2013 there are many new functions for filtering like prefilter, removePrefilter etc. In this post I am going to describe how to use these functions.These functions will also increase performance of crm form.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Here is all about new lookup controls,s methos and events :- </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<h2 style="text-align: left;">
<span style="font-size: small;"><b>1. Method : addCustomFilter() :- </b><span style="font-family: "verdana" , sans-serif;"> </span></span></h2>
<div style="text-align: left;">
<span style="font-size: small;"><span style="font-family: "verdana" , sans-serif;">This<b> </b>function is new in crm 2013. It works as an additional filter to result displayed in lookup dialog each previous filter added with an AND condition to display result in lookup dialog.</span></span><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: justify;">
<span style="font-weight: normal;"><span style="font-size: small;"><b>Note :-</b> </span></span><span style="font-family: "verdana" , sans-serif;"><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></span></div>
<ul style="text-align: left;">
<li><span style="font-family: "verdana" , sans-serif;"><span style="font-weight: normal;"><span style="font-size: small;">This method is only available for <span style="color: black;">updated entities in crm 2013.
</span></span></span></span></li>
<li><span style="font-family: "verdana" , sans-serif;">This method can only be used in a function in an event handler for the Lookup
Control PreSearch Event.</span></li>
</ul>
<div style="text-align: left;">
<span style="font-weight: normal;"><span style="font-size: small;"> </span></span><span style="font-size: small;"><b><span style="font-family: "verdana" , sans-serif;"> </span></b></span></div>
<hr />
<div align="left" style="height: 250px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 230px; margin-bottom: 0px; width: 1000px;">
<span style="font-size: x-small;"><b> </b></span><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span></b><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">addCustomFilter();</span></b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><br />
<span style="font-size: x-small;"><b><span style="font-family: "courier new" , "courier" , monospace;"> </span></b><span style="font-family: "courier new" , "courier" , monospace;"> <span style="font-size: small;"> </span></span></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span>).</span><span style="font-family: "courier new" , "courier" , monospace;">addCustomFilter(<i>filter</i>, <i>entityLogicaName</i>);</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> Here filter is fetch xml for results<b> </b>and entityLogicalName </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> is name of the entity. </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b> Example :- </b></span><br />
<pre> <filter type="and">
<condition attribute="name" operator="eq" value="Test" />
</filter></pre>
</div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">2. How to add custom view on lookup control :- </span></h2>
<div style="text-align: left;">
<span style="font-size: small;"><span style="font-family: "verdana" , sans-serif;"><b>Method</b></span> : </span><span style="font-size: small;"><span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b>addCustomView():- </b><span style="font-family: "verdana" , sans-serif;">This method is used to add custom view on the lookup control.</span></span></span></span></span></span><br />
<br />
<span style="font-size: small;"><span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "verdana" , sans-serif;"><b>Note :-</b> This method does not work on "Owner" lookup. </span></span></span></span></span> </span></div>
<hr />
<div align="left" style="height: 260px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 240px; margin-bottom: 0px; width: 1100px;">
<br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> <b>addCustomView()</b></span><b>;</b> </span></span></span><br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"> </span></span></span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">Xrm.Page.</span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">getControl</span>(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">).</span><span style="font-family: "courier new" , "courier" , monospace;">addCustomView(<i>viewId</i>, <i>entityName</i>, <i>viewDisplayName</i>, <i>fetchXml</i>, <i>layoutXml</i>, <i>isDefault</i>);</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"> <b>Where :-</b> </span><br />
<span style="font-size: x-small;"><b> </b><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">viewId :- unique guid of format </span></span></span><span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">“{00000000-0000-0000-0000-000000000001}”.</span></span></span><br />
<span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> entityName :- Name of the entity of type "string".</span></span></span><br />
<span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> viewDisplayName :- Name of the view(Your custom name)</span></span></span><span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">of type "string".</span></span></span> </span></span></span><br />
<span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"> fetchXml :- fetch for retrieve data </span></span></span><span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">of type "string".</span></span></span><br />
<span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> layoutXml :- layout xml is for showing the records in a format as you want of type "string".</span></span></span><br />
<span style="font-size: x-small;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> isDefault :- Do you want this view as default of type "bool".</span></span><b><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span></b></span><br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"> </span></span></span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">3. How to get default view of CRM lookup control :-
</span></h2>
<hr />
<div align="left" style="height: 170px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 150px; margin-bottom: 0px; width: 1000px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> </b></span><span style="font-family: "courier new" , "courier" , monospace;"><b>getDefaultView();</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span> <br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">var attrParent = </span>Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">).</span><span style="font-family: "courier new" , "courier" , monospace;">getDefaultView()</span><span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> <b>Returns the </b></span><b>Id of the default view of the lookup dialog in </b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> string</b></span><b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">.</span></span></b><span style="font-family: "courier new" , "courier" , monospace;"> </span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;"><b>4. </b>How to set default view of CRM lookup control <b>:- </b></span></h2>
<hr />
<div align="left" style="height: 200px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 180px; margin-bottom: 0px; width: 1000px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> </b></span><span style="font-family: "courier new" , "courier" , monospace;"><b>setDefaultView();</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span> <br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"></span>Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">).</span><span style="font-family: "courier new" , "courier" , monospace;">setDefaultView(</span><span style="font-family: "courier new" , "courier" , monospace;"><i>viewGuid</i>)</span><span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<br />
<b><span style="font-family: "courier new" , "courier" , monospace;">Where :-</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">viewGuid :- Guid of the view.</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "verdana" , sans-serif;"> <b><span style="font-family: "courier new" , "courier" , monospace;">Set,s the default view in lookup dialog .</span></b></span></span> </span></span><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span></b>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"></span> </span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">5. How to add or remove lookup control PreSearchEvent :- </span></h2>
<div style="text-align: justify;">
<span style="font-size: small;"> <span style="font-family: "verdana" , sans-serif;">This is new functionality in CRM 2013. Lookup PreSearchEvent just occurs just before the lookup dialog opens</span></span><span style="font-family: "verdana" , sans-serif;">.<span style="font-size: small;"> Like other form and control events crm form editor does not peovide a way to add PresSerachEvent.This event can be used with other lookup methods like addCustomView, addCustomFilter etc.</span></span></div>
<div style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: small;"><b>Note :-</b> These events only available for all custom entities in crm 2013 and these system entities :- Account, Appointment, Campaign, Campaign Activity,Campaign Response,Case,Competitor,Contact, Contract,Contract Line,Email,Fax,Invoice,Lead,Letter,Marketing List,Opportunity,Opportunity, Product,</span><span style="font-size: small;">Order,Phone Call,Price List Item,Product,Quick Campaign,Quote,Recurring Appointment, Sales Literature,Team,Task,User. </span></span>
</div>
<hr />
<div align="left" style="height: 250px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 240px; margin-bottom: 0px; width: 2938px;">
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span></span><b><span style="font-family: "courier new" , "courier" , monospace;">addPreSearch</span><span style="font-family: "courier new" , "courier" , monospace;">();</span></b><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span> </span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span></span><span style="font-family: "courier new" , "courier" , monospace;">Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">)</span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;">.</span></span></span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">addPreSearch</span>(</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">functionName</span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"></span></span>);</span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span><b><span style="font-family: "courier new" , "courier" , monospace;">Where :-</span></b><b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></b><span style="font-family: "courier new" , "courier" , monospace;">functionName</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">:- is the name of the function which you want to </span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> call before lookup, launch dialog.</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span><b><span style="font-family: "courier new" , "courier" , monospace;">removePreSearch</span><span style="font-family: "courier new" , "courier" , monospace;">();</span></b><br />
<br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> </span></b><span style="font-family: "courier new" , "courier" , monospace;">Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">)</span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;">.</span></span></span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">removePreSearch</span>(</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">functionName</span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;">);</span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span><b><span style="font-family: "courier new" , "courier" , monospace;"> </span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> Where :-</span></b><b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></b><span style="font-family: "courier new" , "courier" , monospace;">functionName</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">:- is the name of the function which you want to remove.</span></span></div>
</div>
</div>
<hr />
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. </span><span style="font-family: "verdana" , sans-serif;">Good luck.</span><br />
<hr />
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0North America38.281889977450582 -103.4531235694885312.759855477450582 -144.76171756948852 63.803924477450579 -62.144529569488526tag:blogger.com,1999:blog-94322812084938119.post-33127988734773978902014-04-12T06:47:00.001-07:002016-02-23T09:01:14.264-08:00New java script functions in CRM 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
New java script functions for CRM 2013.</h2>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my new post with the new java scripts for crm 2013. This post is all about how to change display behavior of crm controls at client side.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;">We access any control on crm from with these objects <b>Xrm.Page.ui.controls</b>, <b>Xrm.Page.uiSection.</b><b>controls</b>,
or <b>Xrm.Page.data.entityAttribute.</b><b>controls</b>.
The <b>Xrm.Page.getControl</b> may be accessed by
<b>Xrm.Page.ui.controls.get</b>. </span></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">In this post I am goint to tell you how to use <b>Xrm.Page.getControl</b> method to access a control. Which control depends on
the arguments passed to the method.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;">
</span><span style="font-family: "verdana" , sans-serif;"> Whenever a form displays or loads in crm 2013 a business process flow control in the header,
additional controls will be added for each attribute that is displayed in the
business process flow. These controls have a unique name like the following:</span>
<code>header_process_<attributename></code>.<br />
<span style="font-family: "verdana" , sans-serif;">Controls displayed in the form header are accessible and have a unique name
like the following: </span><code>header_<attributename></code>.</div>
<h2 style="text-align: left;">
<span style="font-size: small;"><b>1. How to get type of a CRM attribute :- </b></span></h2>
<hr />
<div align="left" style="height: 160px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 140px; margin-bottom: 0px; width: 1000px;">
<span style="font-size: x-small;"><b> </b></span><b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> getControlType();</span></b><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><br />
<span style="font-size: x-small;"><b><span style="font-family: "courier new" , "courier" , monospace;"> </span></b><span style="font-family: "courier new" , "courier" , monospace;"> <span style="font-size: small;"> </span></span></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> var attrType = Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span>).getControlType();</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> <b>Return type will be string. returned values may be standard,optionset,lookup,</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><b> subgrid,notes,webresource,iframe,lookup.</b></span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">2. How to get name of crm attribute :-
</span></h2>
<hr />
<div align="left" style="height: 140px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 120px; margin-bottom: 0px; width: 1000px;">
<br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> <b>getName()</b></span><b>;</b> </span></span></span><br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"> </span></span></span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> </span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">var attrName = </span>Xrm.Page.</span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">getControl</span>(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">).getName(<span style="color: blue;"></span>);</span><br />
<br />
<span style="font-size: x-small;"><b> <span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">Returns the name assigned to the attribute.</span></span></b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"> </span></span></span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">3. How to get parent of crm attribute :-
</span></h2>
<hr />
<div align="left" style="height: 170px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 150px; margin-bottom: 0px; width: 1000px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> getParent();</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span> <br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">var attrParent = </span>Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">).getParent()</span><span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> <b>Returns the object of the parent control or section in which </b></span></span><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> current control resides.</span></span></b><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"></span> </span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;"><b>4. How to get and change label of CRM attribute :-
</b></span></h2>
<hr />
<div align="left" style="height: 160px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 140px; margin-bottom: 0px; width: 1000px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> get<span style="font-size: small;">Label();</span></b> </span> <span style="font-family: "courier new" , "courier" , monospace;"><br /></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> var attrLabel = Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">).</span><span style="font-family: "courier new" , "courier" , monospace;">get<span style="font-size: small;">Label()</span></span><span style="font-family: "courier new" , "courier" , monospace;">;</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><b> set<span style="font-size: small;">Label();</span></b></span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"> </span></span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">var attrLabel = Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">).</span><span style="font-family: "courier new" , "courier" , monospace;">set<span style="font-size: small;">Label(<span style="color: red;">"labelname"</span>)</span></span><span style="font-family: "courier new" , "courier" , monospace;">;</span></span></span> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"></span> </span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">5. How to display or remove notification about the CRM attribute :- </span></h2>
<div style="text-align: justify;">
<span style="font-size: small;"> <span style="font-family: "verdana" , sans-serif;">setNotification method d</span></span><span style="font-family: "verdana" , sans-serif;">isplays a message nearby the attribute to indicate that data entered in the attribute is not valid . Whenever
this method is used on Microsoft Dynamics CRM for tablets a red "X" icon appears
next to the attribute. On tapping on the icon message will display.<span style="font-size: small;"> </span></span></div>
<div style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: small;"><b>Note :-</b> setNotification and clearNotification methods only available for all custom entities and these system entities :- Account, Appointment, Campaign, Campaign Activity,Campaign Response,Case,Competitor,Contact, Contract,Contract Line,Email,Fax,Invoice,Lead,Letter,Marketing List,Opportunity,Opportunity, Product,</span><span style="font-size: small;">Order,Phone Call,Price List Item,Product,Quick Campaign,Quote,Recurring Appointment, Sales Literature,Team,Task,User. </span></span>
</div>
<hr />
<div align="left" style="height: 220px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 200px; margin-bottom: 0px; width: 2938px;">
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span></span><b><span style="font-family: "courier new" , "courier" , monospace;">setNotification();</span></b><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span> </span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span></span><span style="font-family: "courier new" , "courier" , monospace;">Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">)</span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;">.setNotification(</span></span></span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">message</span></span>"</span></span></span>,</span></span></span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">uniqueid</span></span>"</span></span></span>);</span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> //type of uniqueid should be string, it is just used to </span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> remove notification. Returns type of bool. </span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> clearNotification();</span></b></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> </span><br />
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span></span><span style="font-family: "courier new" , "courier" , monospace;">Xrm.Page.getControl(</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "courier new" , "courier" , monospace;">)</span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;">.setNotification(</span></span></span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"></span></span></span><span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;">"</span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: red;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><span style="font-family: "courier new" , "courier" , monospace; font-size: small;">uniqueid</span></span>"</span></span></span>); </span></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "courier new" , "courier" , monospace;"> //Returns type of bool.</span></span></span></div>
</div>
</div>
<hr />
<span style="font-family: "verdana" , sans-serif;">Enjoy the great technology Dynamics CRM. </span><span style="font-family: "verdana" , sans-serif;">Good luck.</span><br />
<hr />
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0tag:blogger.com,1999:blog-94322812084938119.post-88955262350244360882014-03-31T10:44:00.001-07:002014-04-12T03:42:38.250-07:00CRM 2013 basic java scripts<div dir="ltr" style="text-align: left;" trbidi="on">
.<br />
<h2 style="text-align: left;">
Basic Java Script for CRM 2011 and CRM 2013?</h2>
<span style="font-family: Verdana,sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: Verdana,sans-serif;"> Here is my new post with the basic java scripts for crm 2011 and as well as for crm 2013.</span>
</div>
<br />
<br />
<h2 style="text-align: left;">
<span style="font-size: small;"><b>1. How to get and set CRM form attribute value :- </b></span></h2>
<h2 style="text-align: left;">
<span style="font-size: small;"><b>Note :- <span style="font-size: x-small;">Controls that are not bound to an attribute (subgrid, web resource, and IFRAME)
do not have this method. An error will be thrown if you attempt to use this
method on one of these controls.</span> </b></span></h2>
<hr />
<div align="left" style="height: 200px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 210px; margin-bottom: 0px; width: 2000px;">
<span style="font-size: x-small;"><b> </b></span><br />
<span style="font-size: x-small;"><b><span style="font-family: "Courier New",Courier,monospace;"> </span></b><span style="font-family: "Courier New",Courier,monospace;"> <span style="font-size: small;">//Get Object of attribute :- </span></span></span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: small;"> var attr = Xrm.Page.getAttribute(</span><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span>);</span><br />
<span style="font-size: small;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace; font-size: small;"> //Get attribute value :- </span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"> var attr = Xrm.Page.getAttribute(</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">).getValue();</span></span><br />
<span style="font-size: small;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"> //Set attribute value :- </span> </span> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"> var attr = Xrm.Page.getAttribute(</span></span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">).setValue("<span style="color: red;">Value of attrubute type</span>");</span></span></span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"> </span><b> </b></span></span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">2. How to set visibility <span style="font-family: "Courier New",Courier,monospace;"><b>o</b></span>f crm attribute :-
</span></h2>
<hr />
<div align="left" style="height: 140px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 120px; margin-bottom: 0px; width: 2000px;">
<br />
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"> //Set Visible True :- </span></span></span><span style="font-family: "Courier New",Courier,monospace; font-size: small;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: small;"> </span><span style="font-family: "Courier New",Courier,monospace; font-size: small;">Xrm.Page.ui.controls.get(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace; font-size: small;">).setVisible(<span style="color: blue;">true</span>);</span><br />
<br />
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"> //Set Visible False :- </span></span></span><span style="font-family: "Courier New",Courier,monospace; font-size: small;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: small;"> </span><span style="font-family: "Courier New",Courier,monospace; font-size: small;">Xrm.Page.ui.controls.get(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace; font-size: small;">).setVisible(<span style="color: blue;">false</span>);</span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">3. How to enable disable crm attribute :-
</span></h2>
<hr />
<div align="left" style="height: 140px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 120px; margin-bottom: 0px; width: 2938px;">
<span style="font-family: "Courier New",Courier,monospace;"> //</span><span style="font-family: "Courier New",Courier,monospace;">Returns whether the control is disabled :-</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Xrm.Page.getControl(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace;">).getDisabled(</span><span style="font-family: "Courier New",Courier,monospace;">);</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> </span> <span style="font-family: "Courier New",Courier,monospace;">//Set Read Only :-</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Xrm.Page.getControl(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace;">).setDisabled(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="color: blue;">true</span></span>);</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"> //Set Enable True :- <br /> Xrm.Page.getControl(<span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span>).setDisabled(</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="color: blue;">false</span></span></span><span style="font-family: "Courier New",Courier,monospace;">);</span> </span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;"><b>4. How to set focus CRM attribute :-
</b></span></h2>
<hr />
<div align="left" style="height: 140px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 120px; margin-bottom: 0px; width: 2938px;">
<br />
<span style="font-family: "Courier New",Courier,monospace;"> </span> <span style="font-family: "Courier New",Courier,monospace;">//Set Focus True :-</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Xrm.Page.getControl(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span></span></span><span style="font-family: "Courier New",Courier,monospace;">).setFocus(</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="color: blue;">true</span></span>);</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"> //Set Focus False :- <br /> Xrm.Page.getControl(<span style="color: red;">"</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: red;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;">attributename</span></span>"</span>).setFocus(</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace; font-size: small;"><span style="color: blue;">false</span></span></span><span style="font-family: "Courier New",Courier,monospace;">);</span> </span></div>
</div>
<hr />
<h2 style="text-align: left;">
<span style="font-size: small;">5. How to show hide CRM form tab :-</span>
</h2>
<hr />
<div align="left" style="height: 140px; margin-bottom: 3px; overflow: scroll; padding-left: 20px; width: 650px;">
<div style="background-color: white; height: 120px; margin-bottom: 0px; width: 2938px;">
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"> </span></span></span></span><br />
<span style="font-family: Consolas;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"> //Show CRM Tab :-</span></span> </span></span><br />
<span style="font-family: Consolas;"><span style="font-family: Arial, Helvetica, sans-serif;"> <span style="font-family: "Courier New",Courier,monospace;">Xrm.Page.ui.tabs.get(<span style="color: red;">"tabname"</span>).setVisible(<span style="color: blue;">true</span>);</span></span></span></div>
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"> //Show CRM Tab :-</span></span></span></span></div>
<span style="font-family: Consolas;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;"> </span><span style="font-family: "Courier New",Courier,monospace;">Xrm.Page.ui.tabs.get(<span style="color: red;">"tabname"</span>).setVisible(<span style="color: blue;">false</span>);</span></span></span></div>
</div>
<hr />
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0Tippu Sultan's Fort, New Tharagupet, Bangalore, Karnataka 560002, India12.9629472 77.5760913000000312.961980200000001 77.574830800000029 12.9639142 77.577351800000031tag:blogger.com,1999:blog-94322812084938119.post-37657083207695284662014-02-27T09:24:00.001-08:002016-02-23T09:28:10.719-08:00Pass custom query string parameter in CRM 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Pass custom query string parameter in CRM 2013.</h2>
<div>
</div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> This is my new post in which I am going to describe how to pass custom query string parameter in crm2013.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">It is a very good feature of query string parameter in MS CRM. But we have to take care of use it because query string parameter will be visible to end user, so you should not pass confidential info in query string.</span></div>
<div style="text-align: justify;">
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">By default MS CRM allows a set of query string parameters to be passed to a crm form, these parameter must use a standard naming convention.</span></div>
<br />
<span style="font-family: "verdana" , sans-serif;">For detailed information you can fallow this link.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"><a href="http://msdn.microsoft.com/en-us/library/gg334375.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/gg334375.aspx</a> </span><br />
<br />
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">There may be requirement of pass custom query string parameter in your crm2013 application. in this post I am going to tell you how to pass custom parameter of different data types.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u></b> </span></span><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><span style="line-height: 13px;"><span style="line-height: 13px;">Go to Settings=> Customizations => Customize The System</span></span></span></span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><span style="line-height: 13px;"><span style="line-height: 13px;"> => Entities=>Your Entity=>Forms and </span></span>Fallow steps as shown in</span></span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> image.</span></span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAM1dOIH2TtVVi2SOW9eQq0pYAOiyewwFkXqRY9VWKXsQ-6fBIIJypu00kGIhT_NpTuso3vdvdnQKQGYtAq7vKxv34kI3IvCYvwsddLfPR0_lkE7Fnc1pLoEJk0pfbd9lM7AvqhJ5gaUHE/s1600/bp11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAM1dOIH2TtVVi2SOW9eQq0pYAOiyewwFkXqRY9VWKXsQ-6fBIIJypu00kGIhT_NpTuso3vdvdnQKQGYtAq7vKxv34kI3IvCYvwsddLfPR0_lkE7Fnc1pLoEJk0pfbd9lM7AvqhJ5gaUHE/s1600/bp11.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> </span> </span></div>
<br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><b><u>Step 2:-</u> </b></span>Now add the following java script code in your crm 2013 web </span></span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> resource.</span></span><br />
<br />
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 620px;">
<span lang="EN-US"><br /><span style="font-family: "courier new" , "courier" , monospace;">window.open(Xrm.Page.context.getServerUrl()
+<span style="color: red;">"/main.aspx?etn=account</span></span></span><span style="font-family: "courier new" , "courier" , monospace;"><span lang="EN-US"><span style="color: red;">&extraqs=parameter_0=test&pagetype=entityrecord"</span>);</span></span><br />
<br />
<span lang="EN-US"></span>
<b>//To Access the query string parameter on target use the following code</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">var</span> parameters = Xrm.Page.context.getQueryStringParameters();<br />
<span style="color: blue;">var</span> ParameterValue= parameters [<span style="color: red;">"parameter_0"</span>];</span><br />
<span lang="EN-US"></span><br />
<br />
<br />
<div>
<span lang="EN-US">
</span></div>
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span>
</div>
<br />
<u><b><span style="font-family: "verdana" , sans-serif;">Note : -</span></b></u> <span style="font-family: "verdana" , sans-serif;">Remember one importent thing your parameter should add just after</span><br />
<span style="font-family: "verdana" , sans-serif;"> the "extraqs". Like "</span><span style="font-family: "verdana" , sans-serif;">main.aspx?etn=contact&extraqs=param_1=test&</span><br />
<span style="font-family: "verdana" , sans-serif;"> pagetype=entityrecord”.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"> For more information you can visit the fallowing link.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"> <a href="http://msdn.microsoft.com/en-us/library/gg334436.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/gg334436.aspx</a> </span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"> <a href="http://msdn.microsoft.com/en-us/library/gg328131.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/gg328131.aspx</a> </span><br />
<br />
<span style="font-family: "verdana" , sans-serif;">For further help you can leave a comment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Enkoy the great technology Dynamics CRM. Good Luck .....!!!!</span><br />
<span style="font-family: "verdana" , sans-serif;">Thanks </span><br />
<br /></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi, India28.635308 77.2249600000000128.1893855 76.579513 29.081230499999997 77.870407000000014tag:blogger.com,1999:blog-94322812084938119.post-43369429193049762242013-12-22T05:23:00.001-08:002016-03-05T11:45:58.361-08:00Add a button on CRM 2013 form<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to add a button in CRM 2013 form ?</h2>
<div>
</div>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Developers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> This is my new post to add a new button in CRM 2013.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">I can understand the CRM developers requirements, because after release of CRM roll up 12 and CRM 2013, we can access CRM on cross browsers also. when we did customization with java script functionality, It may vary browser to browser, so there may be need of yours to add a custom button in CRM 2013. So here is the simple java script code for CRM 2013 and it will work in CRM 2011(rollup 12) as well as in CRM 2013.</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u></b> Add a attribute of type single line text on crm 2013 form. Or you may use existing one.</span> </span></div>
<br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"><b><u>Step 2:- </u></b></span></span>Add the fallowing code to your crm java script web resource. And call this function on page load.</span><br />
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 620px;">
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> <span style="color: blue; font-size: small;"> </span></span></span><br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue; font-size: small;">function</span><span style="font-size: small;"> createButton() { </span></span></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> <span style="color: blue;">var</span> atrname = <span style="color: red;">"YOUR ATTRIBUTE SCHEMA NAME"</span>;<br /> if (document.getElementById(atrname ) != <span style="color: blue;">null</span>) {<br /> var fieldId = "<span style="color: red;">field</span>" + atrname ;<br /> if (document.getElementById(fieldId ) == <span style="color: blue;">null</span>) {<br /> <span style="color: blue;">var </span>elementId = document.getElementById(atrname + <span style="color: red;">"_d"</span>);<br /> <span style="color: blue;">var </span>div = document.createElement(<span style="color: red;">"div"</span>);<br /> div.style.width = <span style="color: red;">"100px"</span>;<br /> div.style.textAlign = <span style="color: red;">"right"</span>;<br /> div.style.display = <span style="color: red;">"inline"</span>;</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"><br /></span>
<span style="font-family: courier new, courier, monospace;"> childDiv = elementId.getElementsByTagName(<span style="color: red;">'div'</span>)[0]</span><br />
<span style="font-family: courier new, courier, monospace;"> childDiv.style.display = <span style="color: red;">"none"</span>;</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"> elementId .appendChild(div, elementId );<br /> div.innerHTML =<span style="color: red;"> '<button id="' + fieldId + '" type="button" style="margin-left: 3px; width: 100%;" >CRM Form Button</button>'</span>;<br /> document.getElementById(atrname).style.width = <span style="color: red;">"0%"</span>;<br /> document.getElementById(fieldId ).onclick = <span style="color: blue;">function </span>() { YourOnClickFunction(); };<br /> }<br /> }<br />}</span><br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span>
</div>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0India28.610646483879091 77.23297107964754128.164723983879092 76.587524079647537 29.056568983879089 77.878418079647545tag:blogger.com,1999:blog-94322812084938119.post-87854000231487744932013-12-01T00:52:00.002-08:002016-02-23T09:08:09.032-08:00retrieve with java script in crm 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Replacement of SOAP in CRM for single record retrieve in java script. </span></h2>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> First of all thanks for reading my post. As we all know that after CRM </span><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;">Roll-Up 12, SOAP has stopped working for cross browser support in CRM, so we have to write some other code to solve this problem. I found a way to solve this problem so I am sharing it with the beautiful world.</span></span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> </span> </span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> In this post I am going to describe how to retrieve single record with java script of another entity in CRM 2011, CRM 2013 with JSON and OData.It will work on Roll-Up 12, Roll-Up 13 for CRM 2011 and on CRM 2013, and also in cross browsers. It will really help you. For retrieving data please fallow these steps.</span> </div>
<h2 style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><u><span style="font-size: small;"><a href="http://crmjavascripts.blogspot.in/2013/12/retrieve-with-java-script-in-crm-2013.html" target="_blank">Retrieve Single Record with Java Script in CRM 2013</a></span></u></span></h2>
<h2 style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: small;"> </span><u><span style="font-size: small;"><a href="http://crmjavascripts.blogspot.in/2013/11/replacement-of-soap-in-crm-for-retrieve.html" target="_blank">Retrieve Multiple Records with Java Script in CRM 2013</a></span></u></span></h2>
<div style="text-align: justify;">
<span style="font-size: small;"><span style="font-family: "verdana" , sans-serif;"> </span></span><span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u></b> </span> <span style="font-family: "verdana" , sans-serif;">First of all you have to add <span style="font-size: small;">this function in your web resource.</span></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
//***********************************************************************************************************************<br />
//*******Retrive Single recored on the basis of the criteria OData Rest //******************************************************************************************<br />
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 620px;">
<br />
function retrieveRecord(id, odataSetName, successCallback, errorCallback, _excontext) {<br />
var context = Xrm.Page.context;<br />
_executionObj = _excontext;<br />
var serverUrl = context.getServerUrl();<br />
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";<br />
<br />
//id is required <br />
if (!id) {<br />
alert("record id is required.");<br />
return;<br />
} //odataSetName is required, i.e. "AccountSet" <br />
if (!odataSetName) {<br />
alert("odataSetName is required.");<br />
return;<br />
}<br />
//Asynchronous AJAX function to Retrieve a CRM record using OData <br />
$.ajax({<br />
type: "GET",<br />
async: false,<br />
contentType: "application/json; charset=utf-8",<br />
datatype: "json",<br />
url: serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "(guid'" + id + "')",<br />
beforeSend: function (XMLHttpRequest) {<br />
//Specifying this header ensures that the results will be returned as JSON. <br />
XMLHttpRequest.setRequestHeader("Accept", "application/json");<br />
},<br />
success: function (data, textStatus, XmlHttpRequest) {<br />
if (successCallback) {<br />
successCallback(data.d, textStatus, XmlHttpRequest);<br />
}<br />
},<br />
error: function (XmlHttpRequest, textStatus, errorThrown) {<br />
if (errorCallback)<br />
errorCallback(XmlHttpRequest, textStatus, errorThrown);<br />
else<br />
errorHandler(XmlHttpRequest, textStatus, errorThrown);<br />
}<br />
});<br />
}<br />
<br />
function errorHandler(xmlHttpRequest, textStatus, errorThrow) {<br />
alert("Error : " + textStatus + ": " + xmlHttpRequest.statusText);<br />
}<span style="font-family: "consolas"; font-size: 9.5pt;"></span><span style="font-family: "times new roman" , "serif"; font-size: 12.0pt;"></span><br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br />
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 2 :-</u> </b> Now add the fallowing functions with your custom code. Suppose you want to retrieve a record of a entity then write your function in this format.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 621px;">
//**********************************************************************************//*****************Your custom function for retrieving data********************<br />
//**********************************************************************************<br />
function FunctionName() {<br />
var recordId<span style="font-family: "verdana" , sans-serif;">= "guid of the record";</span><br />
if (_condition!= null) {<br />
retrieveRecord(recordId, "EntitySet", getRecord, null, null);<br />
}<br />
}<br />
<br />
//****************************************************************//****************************************************************<br />
<br />
function getRecord(data, textStatus, XmlHttpRequest) {<br />
//debugger; <br />
if (data != null) {<br />
<br />
var attribute1 = data.attribute1 schema name;<br />
var attribute2 = data.attribute2 schema name;<br />
<br />
}<br />
}<br />
<br />
Here "data" is object of retrieved records you can find your required attribute accordingly.<br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
</div>
For more info you can visit.<br />
<h3 style="text-align: left;">
<b><span style="font-size: small;"><a href="http://msdn.microsoft.com/en-us/library/gg309461.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/gg309461.aspx</a></span></b></h3>
<h4 style="text-align: left;">
<span style="color: purple;"><span style="font-size: small;"><a href="http://msdn.microsoft.com/en-us/library/hh169248%28v=nav.71%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/hh169248%28v=nav.71%29.aspx</a></span></span></h4>
</div>
Or you can download odata query designer from this link from here you will get a managed solution import it in your organization and design your odata query according to your requirement. <br />
<h2 style="text-align: left;">
<span style="font-size: small;"><a href="http://crm2011odatatool.codeplex.com/" target="_blank">http://crm2011odatatool.codeplex.com/</a></span></h2>
<br />
<b>So by fallowing all upper steps you can retrieve records . It will work in cross browser and in all new Roll-Up 12,Roll-Up 13 . </b><br />
<b><br /></b>
<span style="font-family: arial, sans-serif;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span> <b><br /></b>
<b>Thanks.</b>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi India, USA, Asia21.671043577718933 79.394524097442627-8.2583064222810663 38.085930097442628 51.600393577718933 120.70311809744263tag:blogger.com,1999:blog-94322812084938119.post-53336772088705256142013-11-16T11:35:00.003-08:002016-02-23T09:07:46.228-08:00Detect browser in crm 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to detect browser in CRM ?</h2>
<div>
</div>
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Here is my findings, In this post i will share with you how to detect browser in CRM. It is not a big task, easy one.</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">I can understand the CRM developers requirements, because after release of CRM roll up 12 and CRM 2013, we can access CRM on cross browsers also. when we did customization with java script functionality, It may vary browser to browser, so there may be need of browser detection in CRM 2011 and in CRM 2013. So here is the simple java script code for CRM and it will work in CRM 2011(rollup 12) as well as in CRM 2013.</span></div>
<br />
<span style="font-family: "verdana" , sans-serif;">Add the fallowing code to your crm java script web resource. </span><br />
<br />
<div align="left" style="background-color: white; height: 340px; margin-bottom: 3px; overflow: scroll-y; padding-left: 20px; width: 600px;">
<div style="bgcolor: white; height: 266px; margin-bottom: 0px; width: 2938px;">
<br />
<br />
Mscrm.Utilities.isIE = <span style="color: blue;">function</span>() {<br />
<span style="color: blue;">return</span> Sys.Browser.agent === Sys.Browser.InternetExplorer<br />
};<br />
<br />
<span style="color: blue;"> function </span>detectBrowser() {<br />
<span style="color: blue;">if</span> (Mscrm.Utilities.isIE()) {<br />
alert(<span style="color: #cc0000;">"You are using IE"</span>);<br />
}<br />
<span style="color: blue;">if</span> (Mscrm.Utilities.isFirefox()) {<br />
alert(<span style="color: #cc0000;">"</span><span style="color: #cc0000;"><span style="color: #cc0000;">You are using</span> Firefox"</span>);<br />
}<br />
<span style="color: blue;">if</span> (Mscrm.Utilities.isChrome()) {<br />
alert(<span style="color: #cc0000;">"</span><span style="color: #cc0000;"><span style="color: #cc0000;">You are using</span> Chrome"</span>);<br />
}<br />
}<br />
<br />
<br />
<span style="font-family: arial, sans-serif;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span> </div>
</div>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0New Delhi, Delhi, India28.635308 77.2249600000000128.1893855 76.579513 29.081230499999997 77.870407000000014tag:blogger.com,1999:blog-94322812084938119.post-2745788245050934522013-11-05T02:54:00.001-08:002016-02-23T09:07:09.252-08:00Retrieve data in crm 2013<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Replacement of SOAP in CRM for retrieve data with java script. </span></h2>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM Lovers,</span><br />
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> First of all thanks for reading my post. As we all know that after CRM </span><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;">Roll-Up 12, SOAP has stopped working for cross browser support in CRM, so we have to write some other code to solve this problem. I found a way to solve this problem so I am sharing it with the beautiful world.</span></span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;"> </span> </span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> In this post I am going to describe how to retrieve data with java script of another entity in CRM 2011, CRM 2013 with JSON and OData.It will work on Roll-Up 12, Roll-Up 13 for CRM 2011 and on CRM 2013, and also in cross browsers. It will really help you. For retrieving data please fallow these steps.</span> </div>
<h2 style="text-align: justify;">
<span style="font-size: small;"></span><span style="font-family: "verdana" , sans-serif;"><u><span style="font-size: small;">Retrieving Multiple Records with ODATA in CRM with Java Script</span></u></span></h2>
<h2 style="text-align: justify;">
<span style="font-size: small;"><span style="font-family: "verdana" , sans-serif;"> </span><u><span style="font-family: "verdana" , sans-serif;">Java script for retrieving data in cross browser</span></u></span></h2>
<div style="text-align: justify;">
</div>
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u></b> </span> <span style="font-family: "verdana" , sans-serif;">First of all you have to add <span style="font-size: small;">this function in your web resource.</span></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
//***********************************************************************************************************************<br />
//*******Retrive Multiple recored on the basis of the criteria OData Rest //******************************************************************************************<br />
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 620px;">
<br />
function retrieveMultiple(odataSetName, filter, successCallback, errorCallback, _executionObj) {<br />
_executionObjMultiretrive = _executionObj;<br />
var context = Xrm.Page.context;<br />
var serverUrl = context.getServerUrl();<br />
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";<br />
//odataSetName is required, i.e. "AccountSet" <br />
if (!odataSetName) {<br />
alert("odataSetName is required.");<br />
return;<br />
}<br />
//Build the URI <br />
var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName;<br />
//If a filter is supplied, append it to the OData URI <br />
if (filter) {<br />
odataUri += filter;<br />
}<br />
//Asynchronous AJAX function to Retrieve CRM records using OData <br />
$.ajax({<br />
type: "GET",<br />
async: false,<br />
contentType: "application/json; charset=utf-8",<br />
datatype: "json", url: odataUri,<br />
beforeSend: function (XMLHttpRequest) {<br />
//Specifying this header ensures that the results will be returned as JSON. <br />
XMLHttpRequest.setRequestHeader("Accept", "application/json");<br />
},<br />
success: function (data, textStatus, XmlHttpRequest) {<br />
if (successCallback) {<br />
if (data && data.d && data.d.results) {<br />
successCallback(data.d.results, textStatus, XmlHttpRequest);<br />
}<br />
else if (data && data.d) {<br />
successCallback(data.d, textStatus, XmlHttpRequest);<br />
}<br />
else {<br />
successCallback(data, textStatus, XmlHttpRequest);<br />
}<br />
}<br />
},<br />
error: function (XmlHttpRequest, textStatus, errorThrown) {<br />
if (errorCallback)<br />
errorCallback(XmlHttpRequest, textStatus, errorThrown);<br />
else<br />
errorHandler(XmlHttpRequest, textStatus, errorThrown);<br />
}<br />
});<br />
}<br />
function errorHandler(xmlHttpRequest, textStatus, errorThrow) {<br />
alert("Error : " + textStatus + ": " + xmlHttpRequest.statusText);<br />
}<span style="font-family: "consolas"; font-size: 9.5pt;"></span><span style="font-family: "times new roman" , "serif"; font-size: 12.0pt;"></span><br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br />
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 2 :-</u> </b> Now add the fallowing functions with your custom code. Suppose you want to retrieve all the records from a entity which has single line text attribute and its value = "multiple retrieve with odata". for this condition you can use this code.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 621px;">
//**********************************************************************************//*****************Your custom function for retrieving data********************<br />
//**********************************************************************************<br />
function YourFunction() {<br />
var _condition<span style="font-family: "verdana" , sans-serif;">= "multiple retrieve with odata";</span><br />
if (_condition!= null) {<br />
retrieveMultiple("Entity NameSet", "?$filter=<span style="font-family: "verdana" , sans-serif;">Attribute Schema Name</span> eq '"+_condition+"' ", RetrieveEntityRecords, null, null);<br />
}<br />
}<br />
<br />
//****************************************************************//****************************************************************<br />
<br />
function RetrieveEntityRecords(data, textStatus, XmlHttpRequest) {<br />
//debugger; <br />
if (data.length > 0) {<br />
for (i = 0; i < data.length; i++) {<br />
var attribute1 = data[i].attribute1 schema name;<br />
var attribute2 = data[i].attribute2 schema name;<br />
}<br />
}<br />
}<br />
<br />
Here "data" is object of all retrieved records, you can find your required attribute accordingly.<br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
</div>
<br />
I know your condition may be differ. <br />
<br />
The filter condition differs on the basis of attribute type so you can visit this link for more conditions...<br />
<h3 style="text-align: left;">
<b><span style="font-size: small;"><a href="http://msdn.microsoft.com/en-us/library/gg309461.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/gg309461.aspx</a></span></b></h3>
<h4 style="text-align: left;">
<span style="color: purple;"><span style="font-size: small;"><a href="http://msdn.microsoft.com/en-us/library/hh169248%28v=nav.71%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/hh169248%28v=nav.71%29.aspx</a></span></span></h4>
</div>
Or you can download odata query designer from this link from here you will get a managed solution import it in your organization and design your odata query according to your requirement. <br />
<h2 style="text-align: left;">
<span style="font-size: small;"><a href="http://crm2011odatatool.codeplex.com/" target="_blank">http://crm2011odatatool.codeplex.com/</a></span></h2>
<br />
<b>So by fallowing all upper steps you can retrieve records . It will work in cross browser and in all new Roll-Up 12,Roll-Up 13 . </b><br />
<b><br /></b>
<span style="font-family: arial, sans-serif;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span> <b><br /></b>
<b>Thanks.</b>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0South East Asia21.616579336740603 79.8046875-6.6545531632593971 38.4960935 49.887711836740607 121.1132815tag:blogger.com,1999:blog-94322812084938119.post-86314939904091774452013-08-09T09:08:00.001-07:002016-02-23T09:06:42.621-08:00Get current user role and name in rollup 14<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> How to get "Current User Role and Role Name" in CRM for roll-up 14. </span></h2>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;">Hello CRM lovers, Here is my blog for getting logged user Role and Role name for Roll-Up 12, Roll-Up 13, Roll-Up 14 and also in cross browser support. I will really help you. For achieving this you have to fallow these steps.</span></div>
<h4 class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</h4>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 1:-</u></b> </span> <span style="font-family: "verdana" , sans-serif;">First of all you have to add reference of J Query main file minimum version jquery1.4.1.min or higher version. you can download it from <a href="http://jquery.com/">http://jquery.com/</a>.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<b><span style="font-family: "verdana" , sans-serif;"><u>Step 2:-</u></span></b> <span style="font-family: "verdana" , sans-serif;">Now you have to add reference of "json2" on your crm entity form, You can get it from sdk, you will find it in your sdk folder.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 3:-</u></b> Now add the fallowing code in your web resource. </span></div>
<h4 class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</h4>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 620px;">
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br />
<br /></div>
//******************************************************************************************<br />
//*******Retrive Multiple recored on the basis of the criteria OData Rest Method************<br />
//******************************************************************************************<br />
function retrieveMultiple(odataSetName, filter, successCallback, errorCallback, _executionObj) {<br />
_executionObjMultiretrive = _executionObj;<br />
var context = Xrm.Page.context;<br />
var serverUrl = context.getServerUrl();<br />
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";<br />
//odataSetName is required, i.e. "AccountSet" <br />
if (!odataSetName) {<br />
alert("odataSetName is required.");<br />
return;<br />
}<br />
//Build the URI <br />
var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName;<br />
//If a filter is supplied, append it to the OData URI <br />
if (filter) {<br />
odataUri += filter;<br />
}<br />
//Asynchronous AJAX function to Retrieve CRM records using OData <br />
$.ajax({<br />
type: "GET",<br />
async: false,<br />
contentType: "application/json; charset=utf-8",<br />
datatype: "json", url: odataUri,<br />
beforeSend: function (XMLHttpRequest) {<br />
//Specifying this header ensures that the results will be returned as JSON. <br />
XMLHttpRequest.setRequestHeader("Accept", "application/json");<br />
},<br />
success: function (data, textStatus, XmlHttpRequest) {<br />
if (successCallback) {<br />
if (data && data.d && data.d.results) {<br />
successCallback(data.d.results, textStatus, XmlHttpRequest);<br />
}<br />
else if (data && data.d) {<br />
successCallback(data.d, textStatus, XmlHttpRequest);<br />
}<br />
else {<br />
successCallback(data, textStatus, XmlHttpRequest);<br />
}<br />
}<br />
},<br />
error: function (XmlHttpRequest, textStatus, errorThrown) {<br />
if (errorCallback)<br />
errorCallback(XmlHttpRequest, textStatus, errorThrown);<br />
else<br />
errorHandler(XmlHttpRequest, textStatus, errorThrown);<br />
}<br />
});<br />
}<br />
function errorHandler(xmlHttpRequest, textStatus, errorThrow) {<br />
alert("Error : " + textStatus + ": " + xmlHttpRequest.statusText);<br />
}<span style="font-family: "consolas"; font-size: 9.5pt;"></span><span style="font-family: "times new roman" , "serif"; font-size: 12.0pt;"></span><br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br />
<span style="font-family: "verdana" , sans-serif;"><b><u>Step 4 :-</u> </b> Now add the fallowing three functions in your web resource, In third function you will get current logged user role name.</span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 621px;">
//**********************************************************************************<br />
//***************** Function For getting the Current User Role********************<br />
//**********************************************************************************<br />
function getOwnerRole(UserID) {<br />
var _Userid = UserID;<br />
if (_Userid != null) {<br />
var istrue = retrieveMultiple("SystemUserRolesSet", "?$filter=SystemUserId eq (guid'" + _Userid + "')", RetrieveDataFromSystemUser, null, null);<br />
}<br />
}<br />
<br />
function RetrieveDataFromSystemUser(data, textStatus, XmlHttpRequest) {<br />
//debugger;<br />
var executioncontext = _executionObjMultiretrive;<br />
var len = data.length;<br />
if (len > 0) {<br />
for (i = 0; i < len; i++) {<br />
if (data[i].RoleId != null) {<br />
<br />
//****************************************************************<br />
//*** This is the first role user have<br />
//*** User may have many roles so you can get all here during loop //******************************************************************************<br />
var userRoleId=data[0].RoleId;<br />
<br />
retrieveMultiple("RoleSet", "?$filter=RoleId eq (guid'" + data[i].RoleId + "')", RetrieveRoleName, null, null);<br />
}<br />
}<br />
}<br />
}<br />
<br />
function RetrieveRoleName(data, textStatus, XmlHttpRequest) {<br />
//debugger;<br />
var executioncontext = _executionObjMultiretrive;<br />
var len = data.length;<br />
<br />
if (data[0].Name != null) {<br />
<br />
var userRoleName=data[0].Name; <br />
}<br />
} <br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
</div>
<br />
<br />
<b>So by fallowing all upper steps you can get current logged user Role Id and Role Name. It will work in cross browser and in all new Roll-Up 12,Roll-Up 13 and Roll-Up 14. </b><br />
<b><br /></b>
<span style="font-family: arial, sans-serif;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span> <b><br /></b>
<b>Thanks.</b></div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0United States;Delhi; Bangalore39.639537564366712 -102.304687514.117503064366712 -143.6132815 65.161572064366709 -60.9960935tag:blogger.com,1999:blog-94322812084938119.post-15529821591639448142013-07-23T06:20:00.000-07:002016-02-23T09:04:37.751-08:00How to get CRM entity attribute value in HTML web resource<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Today i got the requirement of getting CRM entity attribute value in the html web resource which was attached with the crm entity or called on clicking on a navigation link or from a ribbon button.</span></h2>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> You can get parent window object and then you can get object of crmForm then you will get all attribute of entity </span><span style="font-family: "verdana" , sans-serif;"><span style="font-family: "verdana" , sans-serif;">as well as</span> their values.</span><span style="font-family: "verdana" , sans-serif;"> </span></div>
<div style="text-align: justify;">
<br />
<h2>
<span style="font-size: small;">For CRM 2011 </span></h2>
</div>
<h3 style="text-align: left;">
<span style="color: blue;"><span style="background-color: white;">var attrVal = window.parent.document.crmForm.<Attribute Name>.value;</span></span></h3>
<div>
<span style="color: blue;"><span style="background-color: white;"><br /></span></span></div>
<h2 style="text-align: left;">
<span style="font-size: small;">For CRM 2013</span></h2>
<div>
<h3>
<span style="color: blue;"><span style="background-color: white;">var attrVal = window.parent.document.Xrm.Page.getAttribute("<Attribute Name>").getValue();</span></span></h3>
</div>
<div>
<span style="color: blue;"><span style="background-color: white;"><br /></span></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: large;"><span style="font-size: small;"><u><b>Step 1:-</b></u> Add a HTML web resource which you want to use</span></span><span style="font-size: small;">.</span></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: large;"><span style="font-size: small;"><u><b>Step 2:-</b></u></span> <span style="font-size: small;">Add a java script function with the fallowing code in the head section of the HTML web resource.</span></span></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 620px;">
<script type="text/javascript" src="ClientGlobalContext.js.aspx"></script><br />
<script type="text/javascript"><br />
function ABC() {<br />
debugger;<br />
var form = document.forms[0];<br />
var context = GetGlobalContext();<br />
var attrVal = window.parent.document.crmForm.<Attribute Name>.value; <br />
// Your code for your functionality }<span style="font-family: "consolas"; font-size: 9.5pt;"></span><span style="font-family: "times new roman" , "serif"; font-size: 12.0pt;"></span><br />
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</script><br />
<meta charset="utf-8"> </div>
</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-size: large;"><b><span style="font-size: small;"><u>Step 3:-</u></span> </b><span style="font-size: small;">Call java script function on body on load.</span></span></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 621px;">
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</div>
<span style="font-family: "consolas"; font-size: 9.5pt;"><body onload="</span><span style="font-family: "consolas"; font-size: 9.5pt;">ABC()"></span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> </span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> <form method="post" action=""></span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //******************************************</span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //********* your HTML ********************** </span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //******************************************</span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> </form></span><br />
<br />
<span style="font-family: "consolas"; font-size: 9.5pt;"></body> </span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-size: small;"><span style="font-family: "verdana" , sans-serif;">Your final HTML web resource will look like.</span></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-size: large;"><b> </b></span><span style="font-weight: normal;">
</span></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 621px;">
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<html><br />
<head><br />
<title> </title><br />
<script type="text/javascript" src="ClientGlobalContext.js.aspx"></script><br />
<script type="text/javascript"><br />
function <span style="font-family: "consolas"; font-size: 9.5pt;">ABC</span>() {<br />
debugger;<br />
var form = document.forms[0];<br />
var context = GetGlobalContext();<br />
var attrVal = window.parent.document.crmForm.<Attribute Name>.value;</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "consolas"; font-size: 9.5pt;">//******************************************</span><span style="font-family: "consolas"; font-size: 9.5pt;"> //********* your Custom Code ********************** </span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //******************************************</span><br />
}<br />
</script><br />
<meta charset="utf-8"> </div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <body onload="</span><span style="font-family: "consolas"; font-size: 9.5pt;">ABC()"> </span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> <form method="post" action=""></span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //******************************************</span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //********* your HTML ********************** </span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> //******************************************</span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> </form> </span><br />
<span style="font-family: "consolas"; font-size: 9.5pt;"> </body> </span> </div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
</html><br />
<br />
<span style="font-family: arial, sans-serif;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span> </div>
</div>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0Americas41.263485011919848 -104.18128999999988-34.042982488080149 90.584335000000124 90 61.053085000000124tag:blogger.com,1999:blog-94322812084938119.post-86690887282976285102013-06-13T12:27:00.000-07:002016-02-23T09:03:38.722-08:00Current fiscal year in crm 2011<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<h2>
<span style="font-family: "verdana" , sans-serif;">How to get current fiscal year in CRM 2011. </span></h2>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"> Here is my new update. In this update of mine you can know how to get current fiscal year in CRM on the basis of CRM fiscal year settings.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"> Normally fiscal year starts on 1 April to 31 March, but CRM 2011 provides the feature to set our custom fiscal period because fiscal period may differ organization to organization, so there may be need of custom fiscal period, and if custom fiscal period exist then i am sure there will need of current fiscal year. Unfortunately CRM does not stores current fiscal year, so you have to calculate current fiscal year.So in this blog you can get current fiscal year.</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;">Fallow these steps.</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , sans-serif; font-size: 10.0pt; line-height: 115%;"><u style="font-weight: bold;">Step 1:-</u> <span style="font-family: "verdana" , sans-serif;">Click on Settings tab.</span></span></span><br />
<br />
<div style="text-align: start;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;"></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd3ytNCaZNTDVLUmffunaugwrjPjh3TgCv8Unh6WpboZ0wKoAanrEV6NIBgKBGeFBY7S5IDgax28NfWcQVKWlRThA3FNmIhcEcHulCaIRVfAcZCUjVc80i1dGAF473Bcu7bnJZfqxJTGv3/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd3ytNCaZNTDVLUmffunaugwrjPjh3TgCv8Unh6WpboZ0wKoAanrEV6NIBgKBGeFBY7S5IDgax28NfWcQVKWlRThA3FNmIhcEcHulCaIRVfAcZCUjVc80i1dGAF473Bcu7bnJZfqxJTGv3/s1600/1.png" width="400" /></a></span></span></div>
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;">
</span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;"><br /></span></span></div>
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;">
<u style="font-family: Verdana, sans-serif; font-weight: bold;">Step 2:-</u><span style="font-family: "verdana" , sans-serif;"> Open fiscal year year setting.</span></span></span></div>
<div style="text-align: justify;">
<span style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXuGvvdy29DY4ktDRoaoROumSfoJ8eVEr5rjhhA9fyqxm6HB2Mr3dRqFS5Yi_tBfpfvx84RrIntF8e0VKCHzrT1wd3dxshbasyhrc8flRAjm1mv75d6UAM4iPpkneDu_ElIT82-1NdMMIq/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="258" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXuGvvdy29DY4ktDRoaoROumSfoJ8eVEr5rjhhA9fyqxm6HB2Mr3dRqFS5Yi_tBfpfvx84RrIntF8e0VKCHzrT1wd3dxshbasyhrc8flRAjm1mv75d6UAM4iPpkneDu_ElIT82-1NdMMIq/s1600/2.png" width="640" /></a></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<u style="font-family: Verdana, sans-serif; font-weight: bold;"><br /></u></div>
<div style="text-align: justify;">
<u style="font-family: Verdana, sans-serif; font-weight: bold;">Step 3:-</u><span style="font-family: "verdana" , sans-serif;"> Set the start date and other setting regarding fiscal year.</span></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUxGDTMsVG3QGaCAh48WgCe2HzHrNTSBVGmHnz3riFKN-MBmOxEMVXS9xrmi2_cI3mSMmEKuDJRyG8TUkm1JKdvhLEXpwPNW4cNqNIwobhL5N830vw7K_zD_c-3wS-g62bNahGy7lmhdHh/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="414" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUxGDTMsVG3QGaCAh48WgCe2HzHrNTSBVGmHnz3riFKN-MBmOxEMVXS9xrmi2_cI3mSMmEKuDJRyG8TUkm1JKdvhLEXpwPNW4cNqNIwobhL5N830vw7K_zD_c-3wS-g62bNahGy7lmhdHh/s1600/3.png" width="640" /></a></div>
<div style="text-align: justify;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<u style="font-family: Verdana, sans-serif; font-weight: bold;">Step 4:-</u><span style="font-family: "verdana" , sans-serif;"> Now write this java script code to get current fiscal year in any variable, you can write this where you want to use current fiscal year.</span></div>
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 590px;">
<br />
function getCurrentFiscalYear() {<br />
<br />
//Get Current Date<br />
var today = new Date();<br />
var todayDate = today.getMonth() + 1 + "/" + today.getDate() + "/" + today.getFullYear();<br />
<br />
//For rollup 11<br />
var xml = "<?xml version='1.0' encoding='utf-8'?>" +<br />
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +<br />
GenerateAuthenticationHeader() +<br />
"<soap:Body>" +<br />
"<RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +<br />
"<query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +<br />
"<q1:EntityName>organization</q1:EntityName>" +<br />
"<q1:ColumnSet xsi:type='q1:ColumnSet'>" +<br />
"<q1:Attributes>" +<br />
"<q1:Attribute>fiscalcalendarstart</q1:Attribute>" +<br />
<br />
"</q1:Attributes>" +<br />
"</q1:ColumnSet>" +<br />
"<q1:Distinct>false</q1:Distinct>" +<br />
<br />
"</query></RetrieveMultiple>" +<br />
"</soap:Body></soap:Envelope>";<br />
<br />
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");<br />
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);<br />
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");<br />
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");<br />
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);<br />
xmlHttpRequest.send(xml);<br />
<br />
var result = xmlHttpRequest.responseXML.xml;<br />
<br />
var doc = new ActiveXObject("MSXML2.DOMDocument");<br />
doc.async = false;<br />
doc.loadXML(result);<br />
<br />
if (doc.selectSingleNode("//q1:fiscalcalendarstart") != null) {<br />
<br />
var startDate = doc.selectSingleNode("//q1:fiscalcalendarstart").attributes[0].nodeTypedValue<br />
<br />
//Organisation Fiscal start date<br />
var sDate = new Date(startDate);<br />
<br />
var currentDate = new Date(todayDate);<br />
<br />
if (startDate <= todayDate) {<br />
<br />
var diff = currentDate.getFullYear() - sDate.getFullYear();<br />
<br />
var CurrentFiscalYear = (parseInt(sDate.getFullYear()) + parseInt(diff));<br />
<br />
// alert(CurrentFiscalYear);<br />
<br />
<br />
}<br />
else {<br />
<br />
var diff = sDate.getFullYear() - currentDate.getFullYear();<br />
<br />
if (parseInt(diff) == 0) {<br />
<br />
var CurrentFiscalYear = (parseInt(sDate.getFullYear()) - parseInt(1));<br />
//alert(CurrentFiscalYear);<br />
<br />
}<br />
else {<br />
var CurrentFiscalYear = (parseInt(sDate.getFullYear()) - parseInt(diff));<br />
//alert(CurrentFiscalYear);<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
<span style="font-family: arial, sans-serif;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span> </div>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0Bangalore, Karnataka, India12.9715987 77.59456269999998312.4764182 76.949115699999979 13.4667792 78.240009699999987tag:blogger.com,1999:blog-94322812084938119.post-54879421635445666592013-06-10T04:38:00.000-07:002016-02-23T09:03:20.086-08:00How to Convert Option Set in to a Check Box list ?<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
<span style="font-family: "verdana" , sans-serif;">How to Convert Option Set in to a Check Box list with java script.</span></h2>
<span style="font-family: "verdana" , sans-serif;">Here is my new update, in this blog you can find the process
and code to convert option set into a check box list. And one important thing
is that it <b style="mso-bidi-font-weight: normal;">will work on CRM roll-up 11, CRM
roll-up 12 and CRM roll-up 13</b>. So just enjoy the great technology like CRM.</span><br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: "verdana" , sans-serif;"><b style="mso-bidi-font-weight: normal;"><u>
<span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;">Step 1:-</span></u></b><span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt; line-height: 115%;"> First Create option set which you
want to convert into Checkbox list.</span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDPDBG7oS6EftEBjCcw7WpD1PvRWBJGQIolHFlBV08HXeWZV_0QPnbXWOLgcbSwM3vP5wjiuhDJp6KbjENj-2MmFNPzXSUr845aQql_dIaFWSEn519G6bYYRPMunziD_zdoabnKRQNEdUd/s1600/Final1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="296" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDPDBG7oS6EftEBjCcw7WpD1PvRWBJGQIolHFlBV08HXeWZV_0QPnbXWOLgcbSwM3vP5wjiuhDJp6KbjENj-2MmFNPzXSUr845aQql_dIaFWSEn519G6bYYRPMunziD_zdoabnKRQNEdUd/s1600/Final1.png" width="640" /></a></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "verdana" , sans-serif;">
<span style="font-size: 10.0pt; line-height: 115%;">
Step 2:-</span></span></u></b><span style="font-size: 10.0pt; line-height: 115%;"><span style="font-family: "verdana" , sans-serif;"> Create another attribute to store value of
option set.<o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD7A21J94RZlsLUJKrARs3cFpCl4O42k4o5AhA-081nH93ohU3lWDPNSIRP89klIb28LN082NJquWRN-WnOsEYHGj8d3kx-3p7NK_GqSB6QeKcGRDPJ-xSIKov1WKIOlfqkn2g9COsEMD7/s1600/final2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD7A21J94RZlsLUJKrARs3cFpCl4O42k4o5AhA-081nH93ohU3lWDPNSIRP89klIb28LN082NJquWRN-WnOsEYHGj8d3kx-3p7NK_GqSB6QeKcGRDPJ-xSIKov1WKIOlfqkn2g9COsEMD7/s1600/final2.png" width="640" /></a></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "verdana" , sans-serif;">
<span style="font-size: 10.0pt; line-height: 115%;">
Step 3:-</span></span></u></b><span style="font-size: 10.0pt; line-height: 115%;"><span style="font-family: "verdana" , sans-serif;"> Add both the fields on the entity form.<o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2oKwCgjOFcLS3u8vw5kcqiB8YArC62LZT1xpWWLTat8AYSli59hpmpcPKO3Ui35w741gu12Tu2Spoww2QqEMOexlGCTVhFIYEDe03E047f917m61WxFuGS9za4d5fxqLmIS1vRtF-y-9R/s1600/f5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="136" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2oKwCgjOFcLS3u8vw5kcqiB8YArC62LZT1xpWWLTat8AYSli59hpmpcPKO3Ui35w741gu12Tu2Spoww2QqEMOexlGCTVhFIYEDe03E047f917m61WxFuGS9za4d5fxqLmIS1vRtF-y-9R/s1600/f5.png" width="640" /></a></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "verdana" , sans-serif;">
<span style="font-size: 10.0pt; line-height: 115%;">
Step 4:-</span></span></u></b><span style="font-size: 10.0pt; line-height: 115%;"><span style="font-family: "verdana" , sans-serif;"> Create new web resource or update existing
web resource with the fallowing code.</span><span style="mso-spacerun: yes;"> </span></span><br />
<br />
<div align="left" style="background-color: white; overflow: scroll; padding-left: 82px; width: 590px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "verdana" , "sans-serif"; font-size: 10.0pt;">
<span style="mso-spacerun: yes;"> </span></span>
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">function</span><span style="font-family: "consolas"; font-size: 9.5pt;"> Form_onload() {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">var</span> _crtlSociaklNW = document.getElementById(<span style="color: maroon;">"new_socialnetwork"</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">var</span> _crtlTextSocial = document.getElementById(<span style="color: maroon;">"new_textsocial"</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">if</span> (_crtlSociaklNW != <span style="color: blue;">
null</span> && _crtlTextSocial != <span style="color: blue;">null</span>) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>_crtlSociaklNW.style.display = <span style="color: maroon;">"none"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> pdiv = document.createElement(<span style="color: maroon;">'div'</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>pdiv.style
= <span style="color: maroon;">'overflow-y:auto; height:100px; border:1px #6699cc
solid; <span style="mso-spacerun: yes;"> </span>background-color:#ffffff;'</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>_crtlSociaklNW.parentNode.appendChild(pdiv);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: darkgreen;">
///////////////////////////////////////////////////////////////////////////</span><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="color: darkgreen;">///////////////////// Convert option set to
check box//////////////////////</span><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="color: darkgreen;">///////////////////////////////////////////////////////////////////////////</span><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">for</span> (<span style="color: blue;">var</span>
i = 1; i < _crtlSociaklNW.options.length; i++) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> OptionSetItems =
_crtlSociaklNW.options[i];<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">if</span> (!IsChecked(OptionSetItems.text,
_crtlTextSocial)) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> addInput = document.createElement(<span style="color: maroon;">'input'</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>addInput.type = <span style="color: maroon;">'checkbox'</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>addInput.style.pixelWidth = 30;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">else</span> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> addInput = document.createElement(<span style="color: maroon;">'input'</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>addInput.type = <span style="color: maroon;">'checkbox'</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>addInput.checked = <span style="color: blue;">true</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>addInput.style.pixelWidth = 30;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> addLabel = document.createElement(<span style="color: maroon;">'label'</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>addLabel.innerText = OptionSetItems.text;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> addBr = document.createElement(<span style="color: maroon;">'br'</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> formname = Xrm.Page.getAttribute(<span style="color: maroon;">"new_name"</span>).getValue();<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>_crtlSociaklNW.nextSibling.appendChild(addInput);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>_crtlSociaklNW.nextSibling.appendChild(addLabel);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>_crtlSociaklNW.nextSibling.appendChild(addBr);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "consolas"; font-size: 9.5pt;">
///////////////////////////////////////////////////////////////////////////</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "consolas"; font-size: 9.5pt;">///////////////// To check if which check
box is selected//////////////////</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "consolas"; font-size: 9.5pt;">
///////////////////////////////////////////////////////////////////////////</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">function</span><span style="font-family: "consolas"; font-size: 9.5pt;"> IsChecked(pText, _crtlTextSocial) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">if</span> (_crtlTextSocial.value !=
<span style="color: maroon;">""</span>) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">var</span> _crtlTextSocial =
_crtlTextSocial.value.split(<span style="color: maroon;">","</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">for</span> (<span style="color: blue;">var</span>
i = 0; i < _crtlTextSocial.length; i++) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">if</span> (_crtlTextSocial[i] == pText)<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">return</span> <span style="color: blue;">true</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">return</span> <span style="color: blue;">false</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "consolas"; font-size: 9.5pt;">
///////////////////////////////////////////////////////////////////////////</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "consolas"; font-size: 9.5pt;">///function to save the selected Items from
check box list to TextSocial///</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: darkgreen; font-family: "consolas"; font-size: 9.5pt;">
///////////////////////////////////////////////////////////////////////////</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">function</span><span style="font-family: "consolas"; font-size: 9.5pt;"> Form_onSave() {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span><o:p></o:p>
</span>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">var</span> _crtlSociaklNW = document.getElementById(<span style="color: maroon;">"new_socialnetwork"</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span><o:p></o:p>
</span>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">var</span> txtSocialValue = <span style="color: maroon;">
""</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">var</span> getInput =
_crtlSociaklNW.nextSibling.getElementsByTagName(<span style="color: maroon;">"input"</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
<span style="color: blue;">for</span> (<span style="color: blue;">var</span> i = 0;
i < getInput.length; i++) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span><span style="color: blue;">if</span> (getInput[i].checked) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>txtSocialValue += getInput[i].nextSibling.innerText +
<span style="color: maroon;">","</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;">
</span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>
Xrm.Page.getAttribute(<span style="color: maroon;">"new_textsocial"</span>).setValue(txtSocialValue);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "consolas"; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<br />
<span style="font-family: "verdana" , sans-serif;"><b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 10.0pt;">Step 5:-</span></u></b><span style="font-size: 10.0pt;">
Now call </span><span style="font-size: 9.5pt;">Form_onload()</span><span style="font-size: 10.0pt;"> function on Form OnLoad event and </span>
<span style="font-size: 9.5pt;">Form_onSave()</span><span style="font-size: 10.0pt;">
function on form OnSave event. And then save and publish form.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-size: 10.0pt;"><span style="font-family: "verdana" , sans-serif;"> Now your form will look
like this.<o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJDb-UcTCLpJ_AYE3ZZL3paIJaEXGx2p31quXQI6nphSQdNa2dsCfRyvHOzxnQa_7d-5mqJHCYCPWKF-OuFxDfLvXlYj74R9x4Qw61PQB3tTQhGl9bD7gGg4IZNz01As-BYxfd-eQ74ykN/s1600/dsafc.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJDb-UcTCLpJ_AYE3ZZL3paIJaEXGx2p31quXQI6nphSQdNa2dsCfRyvHOzxnQa_7d-5mqJHCYCPWKF-OuFxDfLvXlYj74R9x4Qw61PQB3tTQhGl9bD7gGg4IZNz01As-BYxfd-eQ74ykN/s1600/dsafc.png" width="640" /></a></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p>
</o:p></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p></o:p>
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "verdana" , sans-serif;">
<span style="font-size: 10.0pt;">
Step 6:-</span></span></u></b><span style="font-size: 10.0pt;"><span style="font-family: "verdana" , sans-serif;">
Select check boxes and then save then it will look like this.<o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZibdAsAvzRRB5sMSnalsSyZBdrqq5exVv2iNOz9X2IH08z6zA0PyzjKfKCtR0_PCg4e7TVb2SOwMjZbV6EUuxGrWR3WWcRSIolwAcImPsbXTbHCZwayQ_a4beef1a_oF54GQs5urh-I4d/s1600/hrgfhb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="106" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZibdAsAvzRRB5sMSnalsSyZBdrqq5exVv2iNOz9X2IH08z6zA0PyzjKfKCtR0_PCg4e7TVb2SOwMjZbV6EUuxGrWR3WWcRSIolwAcImPsbXTbHCZwayQ_a4beef1a_oF54GQs5urh-I4d/s1600/hrgfhb.png" width="640" /></a></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p>
</o:p></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p></o:p>
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "verdana" , sans-serif;">
<span style="font-size: 10.0pt;">
Step 7:-</span></span></u></b><span style="font-size: 10.0pt;"><span style="font-family: "verdana" , sans-serif;">
Now Hide TextSocial on the entity form.<o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglN48jFxXmKL9FTdy5QDQM74XM9YA70iXdnOWz1KAvboWtzT5MDw4eKZkoHIcmH8OGc1rqJdmU8gTphVp3KlYKINjIq6vfnyQxfdkH1Fe82oLHiOc05D46BoyqGw5BGWx6QN5bxo5lKD9M/s1600/last.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="486" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglN48jFxXmKL9FTdy5QDQM74XM9YA70iXdnOWz1KAvboWtzT5MDw4eKZkoHIcmH8OGc1rqJdmU8gTphVp3KlYKINjIq6vfnyQxfdkH1Fe82oLHiOc05D46BoyqGw5BGWx6QN5bxo5lKD9M/s1600/last.png" width="640" /></a></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p>
</o:p></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p></o:p>
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "verdana" , sans-serif;">
<span style="font-size: 10.0pt;">
Step 8:-</span></span></u></b><span style="font-size: 10.0pt;"><span style="font-family: "verdana" , sans-serif;">
Now it will look like.<o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyidAYdZOaBdP-5FZRgG2-j14falRq16Y3SRPJ-38E0YcKhI8ao4NA1Q2MWYE-VSPEsxIcGzzQGo0kHGVjmgEtd_NRFJBHGAwx9CzjinOkPHW3p7gYlkw7hHBy4ls4BNJ1cMxWlMb9Q7xg/s1600/Untitled1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyidAYdZOaBdP-5FZRgG2-j14falRq16Y3SRPJ-38E0YcKhI8ao4NA1Q2MWYE-VSPEsxIcGzzQGo0kHGVjmgEtd_NRFJBHGAwx9CzjinOkPHW3p7gYlkw7hHBy4ls4BNJ1cMxWlMb9Q7xg/s1600/Untitled1.png" width="640" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"><b>Soon i will write my new post "How to hide these check boxes on the basis of condition" </b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: arial, sans-serif; text-align: left;">Enjoy the great technology Dynamics CRM. Good luck.....!!!!!</span><span style="font-family: 'Times New Roman'; text-align: left;"> </span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<o:p>
</o:p></div>
</div>
Vinayhttp://www.blogger.com/profile/01323946781851866031noreply@blogger.com0America,Bangalore, Delhi, Pune, Chandigarh,India30.7333148 76.779417930.5149318 76.4566944 30.951697799999998 77.1021414