You are currently browsing the category archive for the ‘Integration’ category.

I was recently looking to build a plug-in that got triggered when two account records were merged.

The plug-in needed to read properties from both the Master record and the sub-ordinate record and to do that I needed the ID of both records.
I couldn’t find much help in the SDK or on the web.

I’ve decided to post some of the code from my plug-in on my blog, just to help anyone who is trying to build something similar.

Good luck!

using System;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using System.Web;

namespace Merge_Plugin
	public class Plug_Merge : IPlugin
		public void Execute(IPluginExecutionContext context)
			Microsoft.Crm.Sdk.Moniker MasterRecord = null;
			Guid SubOrdinateRecord = new Guid();

			// Check whether the input parameters property bag contains a target.
			if (context.InputParameters.Properties.Contains("Target") &&
			   context.InputParameters.Properties["Target"] is Microsoft.Crm.Sdk.Moniker)
				// Obtain the target Moniker from the input parmameters.
				MasterRecord = (Microsoft.Crm.Sdk.Moniker)context.InputParameters.Properties["Target"];
			{ return;}

				//Get the ID of the MasterRecord
				string masterId = MasterRecord.Id.ToString();
				if (context.InputParameters.Properties.Contains("SubOrdinateId"))
					SubOrdinateRecord = (Guid)context.InputParameters.Properties["SubOrdinateId"];
					//Get the ID of the Sub Ordinate Record.
					string subId = SubOrdinateRecord.ToString();
			catch (Exception ex)
				throw new InvalidPluginExecutionException(
					  "An error occurred in the AccountMerge plug-in.", ex);

It is fairly easy to launch an external application from within MS CRM and pass parameters, But sometimes you might need to do it the other way.

I recently had to pass a parameter to an MS CRM form from an external application. I found a way in which you can enable MS CRM 4.0 URL Query string Parameter by making a change to your registry setting on the blog below.

Once you’ve passed a parameter to your MS CRM form the next step would be to parse the URL to get the parameter. I wrote the code below to get the parameter. I’ve posted it on my blog because others might find it useful.

var varParameter = GetQueryString(“parameterNAME”);

if(varParameter != null)
if (varParameter.length > 0)

function GetQueryString(paramName)
queryString =;
params = queryString.split(“&”);
for (i=0;i

I get asked this question all the time. What is possible in different types deployments of MS CRM 4.0? I found this link quiet useful.  The article provides a concise description regarding availability of Microsoft Dynamics CRM extensibility features across the three types of deployments. Very useful if your considering a solution for a client.

Extensibility Feature Deployment Comparison for Microsoft Dynamics CRM 4.0