{#advanced_dlg.about_title}

Demo Code »

Wednesday, July 20, 2011 | 0 Comments

In CRM 4.0, I was very used to having to do the unsupported step of disabling fields one at a time. In CRM 2011, you can now disable the whole form at one time, which makes life much easier in case you remove fields and don’t update the form. (Not that I ever did that…) After doing some Bing searches, I cam across this article on the Microsoft Social site. With some minor modifications, here it is to make your life easier. The scenario here is you have a Status Reason of On Hold in Opportunities. You don’t want users having the ability to edit On Hold Opportunities. So with this script and the Out of the Box Opportunity Entity, you can make that happen. The cool thing is that will also NOT disable the Status Reason Field so you can undo the change! Enjoy! function DisableFieldOnHold() { if (Xrm.Page.getAttribute("statuscode").getValue() == "2") { disableFields(); } function disableFields () { var attributes = Xrm.Page.data.entity.attributes.get(); for (var i in attributes) { Xrm.Page.getControl(attributes[i].getName()).setDisabled(true); Xrm.Page.getControl("statuscode").setDisabled(false); } } if (Xrm.Page.getAttribute("statuscode").getValue() != "2") { enableFields () } function enableFields () { var attributes = Xrm.Page.data.entity.attributes.get(); for (var i in attributes) { Xrm.Page.getControl(attributes[i].getName()).setDisabled(false); } } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

{#advanced_dlg.about_title}

Demo Code »

Tuesday, July 19, 2011 | 0 Comments

The CRM 4.0 SDK had a great example of formatting a phone number for the US. For CRM 2011, that sample isn’t in the SDK that I could find.So after looking at the SDK sample, it looked like it would be pretty easy to upgrade it to CRM 2011. Here is the script modified function FormatPhone(context) { // Get the field that fired the event. var oField = context.getEventSource().getValue(); var sTmp = oField // Validate the field information. if (typeof(oField) != "undefined" && oField != null) { // Remove any non-numeric characters. var sTmp = oField.replace(/[^0-9]/g, ""); // If the number has a valid length, format the number. switch (sTmp.length) { case "4105551212".length: oField = "(" + sTmp.substr(0, 3) + ") " + sTmp.substr(3, 3) + "-" + sTmp.substr(6, 4); break; case "5551212".length: oField.DataValue = sTmp.substr(0, 3) + "-" + sTmp.substr(3, 4); break; } } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   When you put the web resource on the field, check the Pass execution context as first parameter. You now have phone number formatting on each field you have this script on!

{#advanced_dlg.about_title}

Demo Code »

Thursday, June 16, 2011 | 0 Comments

I often get asked about pulling in information from external social networks into Dynamics CRM. And some tools like InsideView and Sonoma Partners provide a much more than just LinkedIn. I wanted something quick and easy to show customers and how partners the power of Dynamics CRM in conjunction with LinkedIn. So using the LinkedIn Widgets, I created a Web Resource in CRM 2011 using HTML. <html>   <head>   <script src="http://www.linkedin.com/companyInsider?script&useBorder=no" type="text/javascript"> </script> <span id="account"></span>   </head>   <body> <script type="text/javascript">   var LIaccountname = parent.window.Xrm.Page.getAttribute("name").getValue();   new LinkedIn.CompanyInsiderBox("account",LIaccountname); </script> </body> </html> parent.window.Xrm.Page.getAttribute("name").getValue(); is what is responsible for getting the company name into the LinkedIn Widget. You could also point this to the Parent Account or any other field in the main form you wanted. Here is the link to the solution file or you can download it from SkyDrive. I am working on making the JScript work under HTTPS. In the mean time, allow IE to display Mixed Content will make it all look pretty.

{#advanced_dlg.about_title}

Demo Code »

Wednesday, June 8, 2011 | 0 Comments

So this really should be called Part 2. It is hard to believe, but it was almost 5 years ago, I posted this. And a couple of years ago, Kevin Williamson from the CRM Online team posted a updated version of using CRM on your Mac. So it has been coming up about once in a while for me and the old blog posts refuse to die. So as things would have it, about four months ago, I purchased an iMac. And after playing with it, it sat in the corner of my office playing music and not much else. Well wouldn’t you know we had a couple of customers who are running CRM in a 1/2 Windows | 1/2 Mac Environment.  So it gave me an excuse to break out the new machine and record some videos. In this quick video, we show how you can connect to a Windows Server using Remote Desktop Services, automatically launch Outlook, Export some data to Excel, edit the data in Excel on the OSX desktop and update it in Dynamics CRM. In future videos, I will show Parallels, Riva, and Mobile Express working on an OSX based machine. This video requires Silverlight. I also have a DemoMate version of it if you would like to use it. below with that HTML. --> DemoMate Tutorial: CRM on OSX with RDS

{#advanced_dlg.about_title}

Demo Code »

Tuesday, May 31, 2011 | 0 Comments

Sometimes to make things flow in CRM, you may want a record saved to allow you to have access to related records. Here is a little script that will help you save records automatically on a field change. If you add this as a Web Resource and call the Function VollmerSaveRecord on an OnChange, it will auto save the record. Searching the SDK for this will also turn up several different options including Save and Close as well. Enjoy! function VollmerSaveRecord() { Xrm.Page.data.entity.save; } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

{#advanced_dlg.about_title}

Demo Code »

Friday, May 27, 2011 | 0 Comments

As you may be aware, you can’t add multiple products via Many to Many Relationships with CRM OOB. So  to make demos a little easier, here is a Solution that will allow you to pick a bunch of products for an appointment and have them stick. Import the enclosed solution and have fun! Create a New appointment Click in the Add New Products Here Click on Add New Products Here.  Select Add Existing Products Pick as many products as you want here.  Click Add Your Appointment form will now look like this: When you mark as completed or save the record, the products will move down to the existing products area.