Archive for April, 2013

Lead qualify process design changes in UR 12 – CRM 2011

April 30, 2013 2 comments

In UR 12, the lead conversion process has been redesigned. Refer below for lead qualify process before and after UR 12

Lead conversion before UR 12

  • Before UR 12, we have “Qualify” button on Lead ribbon
  • It opens a “Convert Lead” web page, which gives us options to create Contact/Account/Opportunity.
Convert Lead

Convert Lead – Before UR 12

After UR 12

With new design, the “Convert Lead” dialog box no longer appears during lead qualification.

  • We have 2 ribbon buttons (Qualify and Disqualify).
Convert Lead - UR 12

Convert Lead – UR 12

  • The qualify button will automatically create the related Opportunity record based on the customer information entered into the Lead form
  • Associated Contact and Account records will also be automatically created based on the First Name, Last Name, and Company Name field data, respectively
  • If you click disqualify you are able to select the status reason, otherwise if you click qualify the lead will just automatically be qualified.

KB Article which talks about the same

Read and Parse XML web resource using Jscript – CRM 2011

April 25, 2013 3 comments

I have a XML file with below content added as a web resource (new_fruitsxml) in my CRM application

<?xml version=”1.0″ encoding=”utf-8″ ?>


<Fruit Code=”App”>




<Fruit Code=”Orng”>





Below is the Jscript code to read and parse the XML.

Note – The code uses JQuery to parse the XML, so you have to refer “jquery1.4.1.min.js” file to make the code works.

function ReadXML() {

try {

var xmlPath = “../WebResources/new_fruitsxml”;


type: “GET”,

url: xmlPath,

dataType: “xml”,

success: parseXML


} catch (e) {

alert(“Error while reading XML; Description – ” + e.description);



function parseXML(xml) {

$(xml).find(“Fruit”).each(function () {

// Read attribute

alert(“Fruit Code – ” + $(this).attr(“Code”));

// Read Nodes

alert(“Fruit Name – ” + $(this).find(“Name”).text());

alert(“Fruit Price – ” + $(this).find(“Price”).text());



  • In “ReadXML()” function we read the webresource and if the read succeeds, we mention the “parseXML()” function in “success: parseXML”
  • So, on success, control comes to “parseXML()” function where we parse the XML


Associate/Disassociate plugin messages in CRM

April 17, 2013 13 comments

In CRM, the Associate or Disassociate event happens

  • If you have a N:N relationship between two entities and when you try to associate or disassociate records either from Associated view or Sub grid.
Entity Associate View

Entity Associate View

In Plugins, the Associate & Disassociate messages behave little different than other messages.

  • When you register a plugin on Associate message, you have to leave “Primary and Secondary” entities as ‘none’.
Associate Plugin Step

Associate Plugin Step

  • Since we don’t provide entity names, the registered Plug-in step triggers on all “Associate” operations, so we have to check few conditions to let the “Association” trigger happen only between intended entities.

You can use the below code template for Associate or Disassociate plugins

            EntityReference targetEntity = null;

            string relationshipName = string.Empty;

            EntityReferenceCollection relatedEntities = null;

            EntityReference relatedEntity = null;

            if (context.MessageName == “Associate”) {

                // Get the “Relationship” Key from context

                if (context.InputParameters.Contains(“Relationship”)) {

                    relationshipName = context.InputParameters[“Relationship”].ToString();


                // Check the “Relationship Name” with your intended one

                if (relationshipName != “{YOUR RELATION NAME}”) {



                // Get Entity 1 reference from “Target” Key from context

                if (context.InputParameters.Contains(“Target”) && context.InputParameters[“Target”] is EntityReference)  {

                    targetEntity = (EntityReference)context.InputParameters[“Target”];


                // Get Entity 2 reference from ” RelatedEntities” Key from context

                if (context.InputParameters.Contains(“RelatedEntities”) && context.InputParameters[“RelatedEntities”] is EntityReferenceCollection) {

                    relatedEntities = context.InputParameters[“RelatedEntities”] as EntityReferenceCollection;

                    relatedEntity = relatedEntities[0];




Access denied error while updating user’s “domain name” field

We have few existing users in our CRM application which we wanted to change the “Domain name”.

Users Domain Name (i.e., User Name field)

Users Domain Name (i.e., ‘User Name’ field)

Also we wanted this update to be done by a User who is not a “System administrator”.

We were getting below exception for few users, when we try to update the domain name of  User record.

Access is denied; Unable to get DNS Name of Domain

Troubleshoot steps

  • Since the logged in user was not “System Administrator”, we thought there was some missing privilege preventing the user to change the domain name
  • But at the same time “System Administrator” is able to update domain name successfully
  • So we tried a trick by copying “System Administrator” role and created a new role and assigned the role to user and tried
  • Still we were getting same exception with copy of “System Administrator” role


  • The reason was “System administrator” role will be having some hidden privileges (Which are not available on Security role form)
  • So the System Administrator role in order to make changes to the logon name.

Below articles helped me to understand the problem

Working with CRM 2011 online – Basics

Below are few things to ponder, when you are new to CRM and moving from “onpremise” to “online”.

Device registration

  • Its very important to get your device registered to connect to CRM online.
  • We need to specify the device credentials many places (for example, credentials are must when you use “crmsvcutil.exe” to generate wrapper class etc…)
  • We use “deviceregistration” tool which comes with SDK (sdk\tools\deviceregistration\bin\Debug\DeviceRegistration.exe) to generate device credentials
  • Open the command prompt and use the command “deviceregistration.exe /operation:Register” to generate the credentials
Device Registration

Device Registration

  • Once you generate the credentials, they get saved in a note file under C:\Users\username\LiveDeviceID
  • Also you can get the credentials by using, the command “deviceregistration.exe /operation:Show”

Registering Plugin

  • While connecting to your online organization using plug-in registration tool, provide
Connect CRM online using Plugin Reg tool

Connect CRM online using Plugin Reg tool

Using “crmsvcutil” with online

  • To generate an early bound class in CRM 2011 online using “crmsvcutil.exe”
    • Your device should be registered to connect to online CRM. Use the “Deviceregistration” tool register the device (Refer Device Registration section)
    • Open command prompt and point to “crmsvcutil.exe” tool which comes with SDK (sdk\bin\crmsvcutil.exe)
    • Provide the command to generate wrapper

CrmSvcUtil.exe /url: /username:user-wlid-email /password:user-wlid-pwd

/deviceid:user-defined-deviceid /devicepassword:user-defined-devicepwd” /out:”Xrm.cs” /namespace:Xrm

Fetch Based Reports

  • Connection string
    • To generate reports with CRM online, you have to provide connection string in below format
      • https://{Org_Name};{ Org_Name }
FetchXML Connection String

Fetch XML Connection String