Category Archives: Uncategorized

The Dynamics CRM resource so many have been looking for

http://www.crmfieldguide.com/

The CRM Field Guide is an essential guide to Microsoft Dynamics CRM that everyone should have on their bookshelf. This book offers you details not only on CRM fundamentals and extensibility points but also the tried and true best practices and strategies of the combined experience of some of the most recognizable global experts in the CRM industry. The field guide contains insights from many CRM MVP contributors and is intended to be a book you pick up over and over again as you use CRM.

This book was announced at eXtremeCRM. While I haven’t read it yet myself, it appears to be a resource many of us have been hoping would come about.  Julie Yack has a blog post explaining the genesis of the book:

http://julieyack.blogs.com/my_weblog/2012/10/introducing-the-crm-field-guide-1029-days-in-the-making-crmfieldguide.html

I just bought the electronic copy.  I’m looking forward to reading it.

@devkeydet

CRM 2011, Visual Studio, and Source Control of non-code customizations

In the latest release of the Dynamics CRM 2011 SDK, a new tool was introduced which creates new options for how teams can source control their non-code customizations.  The tool is called SolutionPackager.  I encourage you to read the following SDK documentation:

Solution Tools for Team Development

As the documentation states:

“The tool identifies individual components in the compressed solution file and extracts them out to individual files. The tool can also re-create a solution file by packing the files that had been previously extracted. This enables multiple people to work independently on a single solution and extract their changes into a common location. Because each component in the solution file is broken into multiple files, it becomes possible to merge customizations without overwriting prior changes. A secondary use of the SolutionPackager tool is that it can be invoked from an automated build process to generate a compressed solution file from previously extracted component files without needing an active Microsoft Dynamics CRM server.”

I recommend you thoroughly read through the SDK documentation before continuing.  I will not explain SolutionPackager in great detail since the documentation does a good job of that already.

Since SolutionPackager is a cmd line based tool, it can be used to integrate with any source control system.  However, most Visual Studio developers probably want to integrate SolutionPackager into Visual Studio.  Furthermore, most probably want to integrate it with the Developer Toolkit for 2011.  The video below walks you through a sample I built which demonstrates how to do just that.  You can download my completed sample here.

@devkeydet

UPDATED SAMPLE: CRM 2011 Windows Store App OData helper

I worked with a partner, EastBanc Technologies, who used the approach I blogged about here and here to build a Windows Store App for a Dynamics CRM solution.  The folks at EastBanc Technologies found some bugs.  We worked together to fix the bugs and they were gracious enough to let me share their changes.  I’ve uploaded the updated sample here:

Visual Studio 2012 Source Code: http://sdrv.ms/S3MND1

CRM Unmanaged Solution: http://sdrv.ms/RYzVzj

You will need the WCF Data Services Tools for Windows Store Apps and Visual Studio 2012 RTM.

If you’ve followed the two previous posts, you’ll notice that I uploaded my samples to new location on my SkyDrive.  The reason is that due to the final terminology for Windows Store Apps, I needed to refactor the solution/project files and class names.  While I plan on updating the walkthrough post when I have a spare moment, I wanted to get the changes published.  Hopefully, the naming changes are obvious enough for folks until I get that post updated.

@devkeydet

Building VB.NET plugins with the developer toolkit

Scenario:

“I’ve seen the Developer Toolkit for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, but it only ships with C# templates.  I’m a VB.NET developer.  How can I get the developer productivity from the toolkit while still writing my plugin code using VB.NET?”

The good news is that SDK obviously supports VB.NET.  The .NET Framework has always allowed you can make calls from C# code to VB.NET code through assembly reference.  Therefore, we can devise a strategy to just make the generated C# code from the toolkit the entry point, but put our plugin code in a referenced VB.NET assembly.

“But my plugin assemblies are sandboxed and database deployed which don’t support referencing other assemblies.”

True, but there’s this wonderful little tool called ILMerge (also available through NuGet).  With ILMerge and a little refactoring, we can achieve this scenario and VB.NET developers can use their language of choice with the developer toolkit.  Here’s a video with step by step instructions.  I use ReSharper in the video to make the refactoring easier.  Everyone who knows me knows I swear by ReSharper, but I understand not everyone loves it like I do or has the budget to acquire it.  I do my best to call out what you’d need to do manually, but you might have to pause now and then if you want to follow along step by step.

You can download the Visual Studio solution that is the output of the walkthrough here.  Reuse it or just grab the post build commands to get this setup yourself, etc.  Hope this helps anyone looking to get more productive with plugin development using VB.NET and the developer toolkit.

@devkeydet

Updated Developer Tips and Tricks Deck

I spend a lot of time talking to .NET developers who are looking at building business applications using Dynamics CRM.  They journey to understanding how to be a productive Dynamics CRM developer can sometimes be daunting.  There’s a bit to learn on top of your existing .NET / web dev skills.  If you go through any CRM developer training, including the Dynamics CRM 2011 Developer Training Kit, you usually won’t get to the level of productivity building solutions that a seasoned CRM developer has.  My Developer Tips and Tricks deck is aimed at helping people get there faster.  I just spent a good part of the day updating the deck.  It’s a living document where I modify as I learn new things.

@devkeydet

Moving an existing Hyper-V vhd to Windows Azure

I talked about building a CRM dev VM running on Windows Azure from scratch here.  However, you might have an existing VM that you’d prefer to run on Windows Azure instead.  Why?  Here are some reasons I can think of which may or may not apply to you:

  • You can take advantage of better hardware.
    • Even though I have a quad core 16 GB laptop, everything just feels like it runs faster in the Windows Azure VM.  Placebo effect?  Maybe.
  • You can access your dev box from just about anywhere with a Windows PC and an internet connection.
  • Windows Azure has better bandwidth than you might have.
    • Run a speed test to compare…make sure you pick a test server closest to your Azure data center for accurate comparison

I am sure there are others.  Feel free to share in the comments.  To get started, you are going to have to upload your .vhd file to your Windows Azure Storage account.  To do this follow the instructions starting at Step 5 from the Creating and Uploading a Virtual Hard Disk that Contains the Windows Server Operating System right until the Upload the VHD file section.  Use the following command line switches for csupload instead (make you have the June 2012 Azure SDK):

csupload Add-Disk –Destination “<full blob url you want for your vhd>” –Label “<whatever you want>” –LiteralPath “<path to your local .vhd>” –OS Windows

After the upload completes, you should be able to go into the management portal, create a new VM using this vhd file.

@devkeydet

Resizing an Azure VM vhd file

UPDATE (09SEP2013): There’s a faster way.  See: https://github.com/maartenba/WindowsAzureDiskResizer

I got into a bit of a predicament where the C drive of the VM I created here started to fill up.  I needed to install some software that only gave me the option to install to the C drive.  The installer was telling me there wasn’t enough disk space.  Here’s what I did to increase the size of the OS disk of my Azure VM:

  • Delete the VM
  • Download the .vhd
  • Resize the downloaded .vhd
  • Delete the original .vhd from blob storage
  • Upload the resized .vhd
  • Recreate the VM
  • Use diskpart to get access to the unallocated part of C

Delete the VM

image

Download the .vhd

Cloud Storage Studio is my favorite storage tool for Windows Azure.  If you’d prefer a free option, then my next favorite is Azure Storage Explorer.  Use one of these to download the .vhd file.  This part is going to require a local hard drive with lots of disk space.  You will need at least 2x the size of the original VHD + the size you want to grow it by.  A fast internet connection will be a big advantage here as well.

Resize the downloaded .vhd

You can use Hyper-V Manager to resize your .vhd file:

image

My challenge was that the PC with the disk space necessary to store the downloaded and expanded .vhd wasn’t Hyper-V capable.  Therefore, I used a tool called VHD Resizer from here.  There is a nice walkthrough of how to use it here.

Delete the original .vhd from blob storage

image

Upload the resized .vhd

You need to upload the resized .vhd back to blob storage.  I figured out how to upload it correctly after reviewing Step 5 from the Creating and Uploading a Virtual Hard Disk that Contains the Windows Server Operating System instructions.  However, the command line switches for csupload.exe need to look like this:

csupload Add-Disk –Destination “<full blob url you want for your vhd>” –Label “<whatever you want>” –LiteralPath “<path to resized .vhd>” –OS Windows

Recreate the VM

I created a new VM via the management portal and pointed it to the .vhd file I uploaded with csupload.  In my case, I had to re-attach an additional .vhd drive since my original .vhd was configured with an F drive where my database files were stored.  Once your VM boots up, log in using Remote Desktop.  For me, all of my SQL Server 2012 databases were in a recovering state.  Not sure why.  After I rebooted my server, everything was fine. 

Use diskpart to get access to the unallocated part of C

Your C drive will still report the old size in Windows Explorer.  You need to claim the additional unallocated space in the expanded drive.  To do this, open a command prompt and execute the following series of commands in italics:

diskpart

Next execute:

list disk

Make sure you select the os disk.  For me, it was disk 0:

select disk=0

Find the partition that needs extending:

list partition

Select the partition.  For me, it was partition 1:

select partition=1

Finally, extend the partition:

extend

Now, you have the additional space in the drive you need to install more stuff Smile.

@devkeydet

Preventing charges for an Azure VM when not in use

When you shutdown an Azure VM, you still get charged for usage.  That’s because the hardware for your VM is still allocated/dedicated to you.  It’s just not being used.  To prevent charges, you can delete the VM.  When you do that, your .vhd file(s) don’t’ get deleted.  Therefore, you can recreate the VM rather quickly when you want to start using it again.  While you can do this manually, it can become tedious depending on how often you need to do it.  The good news is that you can automate this process using PowerShell.  You’ll need to make sure you’ve run through Getting Started with Windows Azure PowerShell first.  Then you can follow the instructions from Importing and Exporting Virtual Machine Settings.  I keep this post handy since I create and delete my VM as needed so I am only charged for the time I am actually using it.

@devkeydet

CRM Solution Manager

Full disclosure, I received a free license from the authors of the tool.  However, I do believe it’s definitely worth the license fee.

I’ve been using the CRM Solution Manager add in for Visual Studio quite a bit lately.  I’ve grown fond of using it over the Developer Toolkit for web resource development.  The biggest reason is because I can right click a set of web resources, deploy AND publish in one click:

image

Another nice feature is that it translates folder structures into web resource names that follow the relative url naming recommendations here:

image

image

One more web resource feature that’s nice is that it allows you to configure JavaScript and CSS minification during the deploy/publish process:

image

I uncheck these during development so I can debug the code, but it’s a nice way to get everything minified for your production release.  While I still find the Developer Toolkit useful for plugins and workflow activities, the CRM Solution Manager has become my tool of choice for web resource development.  It also has other nice features that I haven’t dug into yet.  Check it out! 

@devkeydet

Building an entity model faster through the CRM 2011 import process

Here’s a little tip that, as I speak with customers/partners, I’m discovering isn’t well known.  I will show you how to leverage features of the import process to the fact that import process allows you to build your entities much faster in Dynamic CRM 2011.  It is one approach, but I would love to hear any you might have.  The basic process is:

  • Create entity
  • Create option set fields
  • Create relationships where necessary
  • Import data and create the rest of the fields along the way

To get this to work without prefix side effects, make sure you follow the instructions in my Ensuring you are using your prefix everywhere post first.  Let’s start with a very simple entity model:

 

image

I know, bad example, but I wasn’t feeling creative.  To build this out we’re first going to create the Parent and Child entities:

image

image

NOTE: As a personal practice, I always clear out everything below the Options for Entity section of the form.  You can always go back and add features later, but you can’t undo things that have the + sign next to them. 

Technically, we could create the entity as part of the import process, but I prefer creating it explicitly because I have full control of the creation options.  For Fields of type Option Set, you should create them in the entity ahead of time.  In this example we are going to create a Blood Type field and create a new reusable option set with the values in the picture: 

image

image

Technically, you can create option set fields during the import process, but they won’t be reusable.  Therefore I always create them ahead of time.   For other field types, we’ll create them during import.  Now, let’s go ahead and create a 1:N relationship between the Parent and Child entity:

image

image

Technically, we could create the relationship during import, but I prefer creating it explicitly because I have full control of the options.  Next, create two csv files that look like:

 

Parent.csv

Name,Date Of Birth,Blood Type

Parent1,11/05/2000,O+

Parent2,11/05/2000,A+

Parent3,11/05/2000,B-

 

Child.csv

Name,Date Of Birth,Blood Type,Parent

Kid1,11/05/2000,O+,Parent1

Kid2,11/05/2000,A+,Parent2

Kid3,11/05/2000,B-,Parent3

 

 

Now import Parent.csv:

image

Browse to the file and accept the defaults until you get to this screen:

image

As you can see Blood Type is already mapped to the option set we created.  Map the Date Of Birth field:

image

Keep clicking the Next button until you get to the end and click the Submit button.  The Import Data Wizard will create the remaining field and import the data.  Now let’s get the Child entity set for import.  Go ahead and create the Blood Type option set field for the Child entity like we did for the Parent, but this time reuse the existing option set.  Now import the Child.csv file.  You will have to create a new field for Date Of Birth, but Blood Type and Parent from the input file will have been auto mapped to the corresponding fields in the entity:

image

That’s it!  I’ve shown a really simple example where we really only automated the creation of one field per entity.  I did that to keep the walkthrough simple.  I also walked through why I choose to still manually create option set fields and relationships.  If you apply this technique to creating entities with say 10+ fields, you really start to appreciate the productivity gains of automating the field creation process.  HTH

@devkeydet