Integrating with systems behind a firewall from CRM Online using Windows Azure Service Bus Relay

The Windows Azure Service Bus Relay enables applications hosted anywhere with an internet connection to securely call back to applications hosted in your own datacenter behind a firewall.  The CRM 2011 SDK offers documentation on how to use the Windows Azure Service Bus Relay from CRM Online.  Here’s a link to the documentation that describes the scenario:

http://dkdt.me/HOzzrr

The video below demonstrates a working example of the end to end scenario and walks you through the configuration.

http://dkdt.me/HOzy6X 

NOTE: The video shows my WCF service running in a console application for simplicity.  Many will want to host their services in IIS.  See IIS hosting of Wcf Services with Servicebus Endpoints for more details.

@devkeydet

CRM Online + Windows Azure = Many Possibilities

I have spent some time lately working with both potential CRM Online customers and partners who were unaware of the what’s really possible when you combine CRM Online with Windows Azure.  I primarily work with customers/partners building “enterprise” solutions.  I have heard statements like the following:

“I can’t use CRM Online because I have to integrate with systems behind my organizations firewall.”

“I can’t use CRM Online because I need to write custom ASP.NET pages and Web Services that integrate with my solution.”

Since the material available on the topic is slim, I decided to write a series of blog posts and/or videos demonstrating some common scenarios to get your creative juices flowing.  This post will serve as the table of contents.  Therefore, I will update it periodically.  You will find links to the various scenarios below.  Topics without links are posts I have planned.

Integrating with systems behind a firewall from CRM Online using Windows Azure Service Bus Relay

Going outside the CRM Online sandbox using Windows Azure Compute

Integrating with systems behind a firewall from CRM Online using Windows Azure Compute and Connect

More topics to come…

While these topics are specific to CRM Online + Windows Azure, they also present design principles that can be leveraged in an on-premises deployment that will help you architect a solution that can run in whatever deployment model you choose.

Please let me know in the comments if you have any other questions or ideas for a topics in this series.

@devkeydet

Cascading option set dropdowns with CRM 2011

I get asked this once or twice a month.   

“Does CRM 2011 allow me to configure cascading dropdowns out of the box?”

There is no “out of the box” way to do this using point and click customization through the CRM UI.  I find that when people hear “not out of the box” they immediately think “must write code.”  I see this all the time in xRM implementations.  Lots of cut and paste code that does the same thing.  Developer minded folks tend to have that “I can turn this into a reusable library that power users can ‘configure’ by passing parameters to the web resource.”  That’s the key, build your web resources to be reusable where possible. 

What power users really want is a reusable way to apply the cascading dropdown functionality such that they don’t have to ask a developer to write JavaScript code in the form each time.  CRM 2011 extensibility through the SDK to the rescue! While it’s possible to “roll your own” reusable solution using web resources and the SDK, an SDK sample already exists that does this for you:

http://dkdt.me/IxaX0l

This offers a “no code” solution for the power user because the code is already written.  All the power user needs to know is how to wire up the web resources on the form/field events and what parameters to pass to get it all working. 

UPDATE: Someone pointed out that “in 2011 you can create dependent options sets OOB by using custom entities and filtered lookups.”  That’s an excellent point.  It really depends on whether you want to use lookups or dropdowns.  I do plan on putting together a sample that builds off of my Displaying a lookup as a dropdown in a CRM 2011 form sample to show the filtered lookup approach. 

@devkeydet

New Features for the CRM 2011 JavaScript Model Generator

I blogged about this handy community tool before.  See here.  I just noticed that there’s an update version, as of 3-21-2012, with some new features.  From the Release Notes:

Now supports mult-forms and explicitly setting which attributes, tabs, sections, and left navs to include in the model. Check the documentation for more details.

I requested those features, so I am even more excited about this tool to increase productivity when writing JavaScript code that interacts with CRM 2011 forms.

@devkeydet

SAMPLE: Editable grid for CRM 2011 using jqGrid

A while back, I wrote a post called Building an editable grid for CRM 2011.   The goal of the post was to give you the necessary knowledge to know how to write the code to build an editable grid.  Since then, someone introduced me to jqGrid.  This is quite a powerful JavaScript grid control.  Have a look at the site to see all the things you can do with it.

I’ve built a little sample for a customer using jqGrid.  I wanted to spend some time cleaning the code up and making it more reusable before I blogged about it.  My lofty goal was for it to be a fully reusable editable grid control for CRM.  My thinking was that all you would have to do is drop a web resource on the form, pass the web resource a set of parameters (child entity, columns to display, etc.), and the web resource would render a custom grid based on what you passed it.  Well, as most of my lofty goals for side projects go, I haven’t found the time to get it where I want it to be.  Since then I’ve promised a number of folks to at least share what I have until I can get around to turning this into what I want it to be. 

To get started, download the sample from here.  Unzip the contents somewhere.  If you want to open the Visual Studio solution, you will need the Developer Toolkit for Microsoft Dynamics CRM installed.   Make sure you read the README.txt file in the root of the CrmEditableGrid project.  As I say in the readme:

THIS IS NOT A FULLY REUSABLE EDITABLE GRID CONTROL.  IT IS A SAMPLE DEMONSTRATING HOW
TO USE THE FACILITIES OF THE CRM 2011 SDK COMBINED WITH A POPULAR JAVASCRIPT GRID CONTROL (jqGrid).
WITH THIS AS YOUR STARTING POINT, YOU SHOULD BE ABLE TO USE THE CRM 2011 SDK AND THE jqGrid
DOCUMENTATION TO ADD ADDITIONAL CAPABILITIES TO THE GRID SUCH AS: ADD/DELETE ROW, OPTION SETS, ETC.

To get the sample working, import the dkdteditablegrid.zip file into your CRM organization.  It’s an unmanaged solution.  Make sure you publish all customizations at the end of the import.  I didn’t export the sitemap so you will need to find the Parent entity and add it to the Workplace area to see it:

image

Make sure you publish and refresh the browser so the updates show up.  Ok, I warned you that this sample was incomplete.  To get the editable grid into a useable state, you need to create a Parent record and a couple related Child records.  Navigate to Workplace->Extensions->Parents and create a new parent.  Make sure you Save (not Save & Close).

image

Now navigate to Related->Common->Children and add a couple children.

image

Once you’ve added a couple children.  Close the form and open it again.  Like I said, work in progress.  What you’ll see is a grid on the form that looks something like this:

image

If you click the “e” button, then you’ll put the record in edit mode.  The “c” button cancels and the “s” button saves the record.  The way this works is as follows:

  • The grid is an html web resource that is passed the record id from the parent form
  • When the web resource loads, it makes an OData query for the children
  • Upon query completion, it wires up the data to the jqGrid
  • When “s” button is clicked, the code updates the child record through the OData service

The goal of this sample, for now, is to have enough of the core plumbing in place for you to take and elaborate to your specific scenario.  Once you realize how capable jqGrid is, then you’ll understand that it’s not that big of a leap forward to get to where you want to be.  I still plan to transform this from a code sample to something people can just pickup and use on many forms by passing a few parameters to the web resource.  Of course, time needs to be on my side…yes it does.  Let me know if you beat me to it! 

@devkeydet

Two MUST HAVE CRM 2011 Resource Lists

I just discovered two TechNet Wiki’s that are indispensible:

Microsoft Dynamics CRM 2011 Resources

Microsoft Dynamics CRM 2011 Development Resources

Add these two to your favorites/bookmarks.  This is the best running list of resources for Dynamics CRM 2011 that I have come across.  What’s great is that since they are Wiki pages, they are living documents that get updated by a community of people!

@devkeydet

CRM 2011 JavaScript Model Generator

http://dkdt.me/ycgdJJ 

This my newest favorite tool for Dynamics CRM development!!!

It’s a tool that creates a ViewModel-esque class for a given form.  As the text on the home page says:

“The JS Model Generator will go and grab the Form XML for specified entities and create objects for each attribute, tab, section, and left navigation item that currently exists on the published Main form. This allows you to use intellisense to see which attributes, tabs, sections, left navigation items exist on the form and also provides easier syntax than using Xrm.Page. “

@devkeydet

Dynamics CRM 2011 Script# Xrm.Page library

I love it when something becomes community driven! 

A few months ago, I blogged about Script# & Dynamics CRM 2011.  Since then, I‘ve been working on a little side project to make it easier to get started.  As with most side projects, you do them when you find the time.  Unfortunately, time has not been on my side. 

I just got word from @NZxRMGuy that he’s created an open source project on CodePlex that’s a Script# Import Library for Xrm.Page.

http://dkdt.me/wy9Jlu

He mentioned on Twitter that he also plans on putting this on NuGet.  This is fantastic news!  I just tried a few simple scenarios with the library.  Works like a charm! 

@devkeydet 

PS – Adding the text ScriptSharp for search engine optimization.

Minifying your CRM 2011 JavaScript and CSS

Minification is a popular technique in web development.  The benefits are equally as applicable to Dynamics CRM 2011 JavaScript and CSS web resources.  My minifier of choice is the Microsoft Ajax Minifier because it integrates well with the Visual Studio 2010 build system.  I’m a proponent of using the Developer Toolkit for Microsoft Dynamics 2011 to develop my customizations through Visual Studio 2010.  If you aren’t using the toolkit, then the Using AjaxMinTask.DLL in your Visual Studio Project instructions will work just fine.  However, if you follow these instructions with a “Dynamics CRM 2011 Package” project, then you will be disappointed when your files don’t get minified.  This project type seems to have some limitations with build automation.  This post shows you a workaround to get it to work.  Make sure you’ve installed the Microsoft Ajax Minifier before following these instructions.

We’ll start with a package project that already has a JavaScript and CSS file called MinifyMe.js that I want to minify:

image

The next step is hackish, but works.  We’re going to add an empty project where we can put our AfterBuild Target from the Using AjaxMinTask.DLL in your Visual Studio Project instructions.  Then we’re going to modify the project file slightly differently to get it all working.  Add a Class Library project to the solution:

image

Follow the first set of instructions from Using AjaxMinTask.DLL in your Visual Studio Project to update your project file with the added XML snippet.  Don’t save/reload your project just yet.  Update the “<JS Include” and “<CSS Include” values to point the the location on disk of your of your “WebResourcesScript (JScript)” and “WebResourcesCascading Stylesheet (CSS)” folders.  Mine look like this:

<JS Include=”=”$(SolutionDir)CrmAjaxMinifierWalkthroughWebResourcesScript (JScript)*.js” Exclude=”***.min.js” />

<CSS Include=”$(SolutionDir)CrmAjaxMinifierWalkthroughWebResourcesCascading Stylesheet (CSS)*.css” Exclude=”***.min.css” />

Here’s a screenshot:

image

Right-click the unloaded project and select “Reload Project”:

image

Build the solution.  Minified files will have been created, but you won’t see them in Visual Studio.  You need to right-click the “Cascading Stylesheet (CSS)” and “Script (JScript”)” folders to add the existing files.  Here’s some screenshots of adding the MinifyMe.min.js file:

image

image

Once you’ve done that, you will have both fully formatted and minified files in your “Dynamics CRM 2011 Package” project:

image

Compare the MinifyMe.js source from the first screenshot to the MinifyMe.min.js file in the last.  The JavaScript has been minified.

@devkeydet

Getting a more Metro-like desktop

So I made the leap.  I am using the Windows 8 Consumer Preview as my primary laptop.  Given that I use a number of Hyper-V VMs, I am really diggin the Client Hyper-V feature of Windows 8.  No more reboot, boot to my Win2k8R2 base OS, spin up my VHD.  Now I can spin it up right from my primary client OS on my laptop.  But I digress…

I use the following settings for my Start screen color scheme:

image

…which gives me the following start screen look:

image

By default, when I switched to the Desktop, I had the Aero theme configured:

image

For me, the default Aero theme with with the the blue color hints and the rounded buttons with gradients is a bit too much of a contrast.  Have no fear, Windows 8 has all sorts of knobs to suit your preferences.  I reconfigured my desktop settings to look like this:

image

Notice the flat buttons and color scheme that matches my Start screen personalization a bit better.  The transition to the desktop just feels smoother for me this way.  Plus I kind like the “retro metro” look it gives the desktop experience.  A couple people who’ve seen this have asked me “Is that a newer build of Windows 8?”  Nope, I just changed the defaults.  If you like it, here’s how to do it yourself:

Right-click on the Desktop and select Personalize from the context menu:

image

    Select the Windows Basic theme:

    image

      Select Windows Color:

      image

        Select the color that closely matches your start screen and move the color intensity to match your preference:

        image

          Save changes.

          There you go.  You now have a desktop experience that, in my opinion, blends a little better with the start screen and overall Metro look and feel.  As they say, Your Mileage May Vary (YMMV).

          @devkeydet