Updating Plugins and Workflow Activities

When updating plugins or workflow activities, if you are adding input / output parameters, or changing the name or display, sometimes after updating, the changes do not take effect within the Dynamics Workflow editor.

Instead of having to stop and start services, did you know that the update can be triggered by changing the assembly version information before you update.

In Visual Studio, just edit the properties of your Workflow Project as outlined in the screenshots, increment the assembly version, and rebuild and deploy.  The change in version will be enough for Dynamics to refresh its cache for using the activity in the workflow designer.

assemblyinfo1assemblyinfo2

Migrating an Organisation to a new server

Sometimes, you need to be able to move or duplicate an existing Microsoft Dynamics CRM 2011 organisation database to a new or different server, perhaps for testing purposes, or just simply for a backup.  This is relatively straight forward as the entire organisation is kept in the one database.

To do this, from within SQL Server Management Studio, you first need to backup the database by right clicking the database name, and selecting Backup from the Tasks menu.

Migrate

Once you have created a backup of your organisation database, on the new sql server that will be hosting the new environment, you need to restore the database so that it is available dor CRM to use.  You do this from the Tasks menu as well.

Migrate1

Once the SQL Database is in place, on the Dynamics Application Server you need to use the Import function within the Deployment Manager tool to import the database into an organisation.

Migrate4

Select the SQL Server and the name of the database.

Migrate5

This will then attempt to map the users within the source database into the current domain and start the import process.  When this is complete, you will have a fully functioning copy of the organisation.

Shared Data Source for reporting

When developing reports for Microsoft Dynamics using SQL connections, it is recommended to use a shared data source so that you can include your reports within a solution and allow them to be promoted across different environments without having to amend the data source.

Microsoft Dynamics provides a Data Source called MSCRM_DataSource which always points to its SQL environment, so if your reports use a shared data source called the same, it doesn’t matter which environment it is installed on, it will be using the correct Data Source for your SQL server.

Shared Data Source in Report Project
Shared Data Source in Report Project

CRM 2011 Checking for changed fields in a form

Sometimes, when trying to close a form down in Dynamics, or trying to print preview, you will often get the following message.

isDirty

This will nearly always mean that when the form has loaded, some of the attributes have actually changed, so Dynamics detects that the form is not up to date, and requires a save before proceeding.

This can sometimes be tricky to work out what has changed, so below is a useful little trick.

In Internet Explorer, hit the F12 key when the form is displayed, and select the script tag.  Copy and paste the following code in to the script input area and run it.  This should then print out the name of all of your “Dirty” fields.

var listOfAttributes = frames[0].Xrm.Page.getAttribute();
for(var attrib in listOfAttributes){
   var currentAttrib = listOfAttributes[attrib];
   if (currentAttrib.getIsDirty && currentAttrib.getIsDirty()){
     console.log(currentAttrib.getName());
   }
}

CRM 2011 Web Resource Linker / Publisher

This is an excellent utility for visual studio 2012 (and 2010 with a bit of tinkering) that allows you to publish JavaScript and other web resources straight from Visual Studio. It’s a huge time saver and seems to be pretty reliable. It’s an essential part of my workflow now.

http://webresourcelinker.codeplex.com

Depending on the version of Visual Studio you use, all you need to do is edit the WebResourceLinker.AddIn file, and change the Version element of the XML to one of the following :

Visual Studio 2010

<Version>10.0</Version>

Visual Studio 2012

<Version>11.0</Version>

Visual Studio 2013

<Version>12.0</Version>

After that, just copy the contents to your Visual Studio 201x\Addins folder for it to work.

You may also need to manualy unblock each DLL in the addin folder as well to get it to work.

Entity Documentation Generator

A useful utility that should always be used to document your entities when developing them is the Metadata Document Generator.  With this, you can point it at your Dynamics Install and have it produce documents outlining your custom entities, and their fields and relationships.  This is always useful to have on hand when developing, or reporting on your data.

http://metadatadocgenerator.codeplex.com/releases/view/94885