Advertisements

Archive

Archive for December, 2011

“Object of type can not be converted to type ‘IBusinessEntity’ ” exception with crm Early Binding

December 28, 2011 3 comments

Hi,

You may come across below exception in Plug-Ins, while performing Create/Update operation  using CRM early binding

Exception: Unhandled Exception: System.InvalidOperationException: Object of type ‘entity_name‘ can not be converted to type ‘IBusinessEntity’

Fix :-

  • You need to add below line in your Plug-in project’s “AssemblyInfo.cs” file (Navigate to project folder and go to ..\Properties\AssemblyInfo.cs)

[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]

AssemblyInfo.cs

AssemblyInfo.cs

  • Clean and Rebuild the solution
  • Register the plug-in assembly

Hope it helps 🙂

 

Advertisements

Could not load file or assembly ‘Microsoft.IdentityModel’ exception on wrapper class generation in CRM 2011

December 26, 2011 1 comment

Hi,

You may come across the below exception while generating wrapper classes using “crmsvcutil.exe” tool which comes along with CRM SDK.

Could not load file or assembly ‘Microsoft.IdentityModel Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find specified

Reason :-

        The reason for this error could be the machine does not have “Windows Identify Foundation Pack” installed

Fix :-

Hope it helps 🙂

“Could not open a connection to SQL Server” error while installing CRM 2011 Server

December 21, 2011 1 comment

Hi,

You may come across below exception while installing CRM 2011 Server.

“Named Pipes Provider, error: 40 – Could not open a connection to SQL Server “

Scenario :-

  • You have a standalone machine “VM 1”, with SQL Server 2008  application
  • You have another machine “VM 2”, where you are trying to install “CRM Server” by pointing to the SQL Server on “VM 1”
  • Installation wizard throws the “Could not connect to….” exception in the midway

Reason :-

  • Remote connection was not enabled on SQL Server machine

Fix :-

  • Connect to the machine where SQL Server 2008  installed
  • Open the “Sql Server Configuration Manager” (i.e.,  Start –> All Programs –> Microsoft SQL Server 2008 R2 –> Configuration Tools)
  • Enable “Named Pipes” protocol (Refer below screen)
Enable "Named Pipes" protocol

Enabling "Named Pipes" protocol

  • Restart the “MSSQLSERVER” service (Go to “Run -> Services.msc”)
Restart "MSSQLSERVER" service

Restart "MSSQLSERVER" service

  • Resume the installation.

Hope it helps 🙂

JScript validation on Activation/Deactivation of record in CRM 2011

December 13, 2011 3 comments

Hi,

We can perform JScript validation on Activation or Deactivation of  a record in CRM 2011.

We can achieve this by reading event save mode from CRM context (i.e.,CRM returns unique Codes or Numbers for different actions; Example 5 for Deactivation button click & 6 for Activation click).

Note :-  CRM 2011 JScript allows us to pass “Execution Context” as first parameter to Jscript function.

Below are the steps

1) Create a new Jscript file and place below JScript function

// Use the following function on Form Save Event,

// CRM will pass the execution context in function paramter prmContext

function FrmOnSave(prmContext) {

var wod_SaveMode;

if (prmContext != null && prmContext.getEventArgs() != null) {

// “getSaveMode()” returns event mode value (i.e., 5 on Deactivation button click etc…)

wod_SaveMode = prmContext.getEventArgs().getSaveMode();

// 5 will pass on Deactivate button click

if (wod_SaveMode == 5) {

// Write your “Deactivate” validation code here

alert(“Deactivation event fired”);

}

// 6 will pass on Activate button click

elseif (wod_SaveMode == 6) {

// Write your “Activate” validation code here

alert(“Activation event fired”);

}

// Use the code line below only if validation is failed then abort function save event

prmContext.getEventArgs().preventDefault();

}

}

2. Add the JScript file as a webresource to the default solution

3. Register the function on “onsave” event (As below)

JScript event handling on record Activation

JScript event handling on record Activation

Check "Pass execution context as first parameter" checkbox

Check "Pass execution context as first parameter" checkbox

4. Save & Publish

5. Open the record and click on “Activate/Deactivate” button (Refer below screen)

Alert on record activation

Alert on record activation

– Below is the useful post on the same

http://social.technet.microsoft.com/wiki/contents/articles/4122.aspx

Hope it helps 🙂

Hide left navigation items pane on form in CRM 2011

December 12, 2011 5 comments

Hi,

We can Hide the “Navigation items” pane on the CRM form using simple form customization.

    • Open CRM form customization screen
    • Click on “Form Properties” button in  “Form” tab
    • Go to “Display” tab and uncheck “Show navigation items” (Refer screen below)
    • Save & Publish
Hide Nav Items section

Show/Hide Navigation items setting

After this setting “Open” the form and you will get form without “Navigation” section (As below)

CRM form with no Navigation section

CRM form with no Navigation section

Hope this helps 🙂