Archive

Posts Tagged ‘crm 2011’

Outlook Client: Cannot find any organizations on the server. Try entering the URL again

ISSUE

We took the database backup of production CRM and restored in UAT and imported the organization to create UAT CRM environment.  Users would like to connect Outlook client to both Production and UAT, but when user tries to add the second environment (it doesn’t matter which order), we get below error message:

Cannot find any organizations on the server. Try entering the URL again. If the problem persists, contact your system administrator.

CAUSE

Whenever an organization is configured in outlook there will be an entry in the registry with that organization GUID and the outlook client automatically detects there is one organization with the GUID of the first organization and therefore, while configuring the second organization with the same GUID, the CRM outlook client does not detect the organization ID

WORKAROUND TO COME ACROSS

  • Restore the production organization database as TempUAT on the UAT server
  • Build TempUAT organization in UAT server
  • Backup the TempUAT and restore it as UAT on the UAT server
  • Build UAT organization on UAT server
  • Then the outlook client will identify both the organizations

Disable Trace in CRM 2011

January 11, 2013 Leave a comment

Recently our testing server was getting loads of data through CRM Trace. When we check the trace properties all the keys mentioned as part of the Microsoft article are disabled.

We tried by

  • Updating the registry entries Enable/Disable
  • Removed all the Trace related entries
  • Restarted the IIS and Machine for some times
  • Used Diagnostic Tool to do the same jobs again

Still no luck….

At the end after some research on CRM Files/Database/Registry and Bing found that after Update Roll Up 6 these settings were moved to MSCRM_CONFIG database.

Here are the queries to check or to update the Trace settings

select * from OrganizationProperties where ColumnName =‘TraceEnabled’

update  OrganizationProperties set BitColumn =‘0’where ColumnName =‘TraceEnabled’

Hope this helps some body 🙂

Get away from “Error – Subreport could not be shown”

October 10, 2012 Leave a comment

As part of development we used to restore CRM organization many times. Recently we found that the out of the box reports are giving problems which have sub reports.

When we try to open a report it is giving “Error – Subreport could not be shown” whereever there is reference to sub report.

Problem here is the relation between parent report and sub report got disturbed and CRM doesnot able to link these two reports.

Resolution (atlease in my case):

  • From Reports section select the sub report and click on edit
  • Remove the value in Parent Report look up field
  • Map Parent Report again

This would solve the problem. But in some cases we may need to re-publish the reports. Below steps will help us in publishing the reports again

  • Open command prompt on CRM application server
  • Go to Microsoft Dynamics CRM\Tools folder
  • PublishReports.exe NameOfYourOrg
  • Ex: C:\Program Files\Microsoft Dynamics CRM\Tools\PublishReports.exe mytestcrm

Hope this helps 🙂

CRM like scroll bars in HTML web resource or custom page

August 6, 2012 1 comment

When we show HTML web resource or custom aspx pages as part of CRM we may need to show the same styles for the custom pages. Here is the style script to show CRM like scroll bars as part of HTML web resource or aspx pages


<STYLE type="text/css">
    .TA {
scrollbar-base-color: #E9EDF1;
scrollbar-arrow-color: #3b3b3b;
scrollbar-3dlight-color: #A5ACB5;
scrollbar-darkshadow-color: #A5ACB5;
scrollbar-face-color: #E9EDF1;
scrollbar-highlight-color: #E9EDF1;
scrollbar-shadow-color: #E9EDF1;
scrollbar-track-color: # E3E8ED;
}

}  </STYLE>
<body class='TA'>

</body>

Hope this helps 🙂

Signature in Emails using Personal Email Templates

Just like in Outlook users are interested in using Signature facility when creating the Emails in CRM. To get this we can make use of Personal Email templates available.

Personal Email templates will be available for all the users and the one which is created by one user can not be accessed by others unless it is marked for Organization level access.

Here is the way,

  • Go to File–>Options–>Email Templates
  • Select New
  • Select Global as Template Type in the pop up
  • Enter Title as <<User Name Signature>>
  • Enter Subject, As this is a required field we need to give some value here. But When you use the template you can select Not to override the existing subject line
  • Have your signature as part of Body
  • Save and Close

Use Signature Email Tempalte

  • Create an Email activity
  • You can click on Insert template and select the template created above
  • If you first enter the email details like Subject and Body, System will give a confirm box to replace the subject line with the templates subject. Here you can select Cancel to continue with the existing subject line

Hope this small tip helps somebody 🙂

Resolving Duplicate Lookup References in Import Process

Normally when we import records which has a related entity, import process will resolve the lookup reference if it finds single record in the parent entity otherwise, it will stop processing the record and ends in fail.

Ex: When we are importing a Contact (Contact1) with Parent Account (Account1) and system has two accounts with same name then Import process gives error when processing Contact1

To resolve these types of records we need to make a small tweak before submitting the import job. Here we go

Click on Edit in the mapping dialog

Go to Parent Account field in the list of mappings and click on Lookup

Set the unique field as the reference

Now in the import file add the data as Account Number for Parent Account field.

Hope this helps 🙂

Unit Testing CRM 2011 Plugin

January 23, 2012 4 comments

As we all know the criticality of developing and deploying plugins in CRM. Let’s think the scenario of having 20 plugins in our project but we need to change one plugin. When we deploy this with Plugin registration tool, we are going on an assumption that other 19 are working properly and the one which is updated still needs to be tested on UAT/Production server. If we have a chance to test all 20 plugins without registering them on to server then that would be a great opportunity 🙂

Normally to test plugins we must register the plugin to CRM server before testing. This is a fairly lengthy process, making quick testing of changes, and well as automated unit testing is a difficult process.

There is a solution to this problem which was developed by Andrew Swerlick based on Dinesh’s Solution and is available at http://crm2011plugintest.codeplex.com/ Source files are available here, we can download and compile them. To make the solution work we need to look into patches and make the changes in code then compile.

or simply download the working dlls from here

By serializing the objects that the CRM server passes to a plugin on execution and then by using a library that allows us to de-serialize those objects and pass them to the plugin on our local machine we can simulate actually having the plugin registered against the server but without having to go through the process of registering it for each and every change.

I will be using a plugin which will add Business Phone to newly created contacts.

 Code of the plugin looks like

public class UpdateContactPhonePlugin : IPlugin
{
IOrganizationService service;
public void Execute(IServiceProvider serviceProvider)
{
Microsoft.Xrm.Sdk.IPluginExecutionContext context = (Microsoft.Xrm.Sdk.IPluginExecutionContext)serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));

IOrganizationServiceFactory factory =(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

service = factory.CreateOrganizationService(context.UserId);

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity entity = (Entity)context.InputParameters["Target"];
try
{
if (entity.LogicalName == "contact")
{
entity.Attributes.Add("telephone1", "123456");
}
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException(ex.Message.ToString());
}
}
}
}

Once we sign and build the plugin project and ready with it we need to do the following to test.

Create a new project of type ClassLibrary and add Libraries folder which is having

  1. SerializePluginContext.dll
  2. TestPlugin.dll

 

 

Serializing the Plugin Context

 

  1. Register the SerializePluginContext plugin on the CRM server using the plugin registration tool. When registering the plugin, register it exactly as if we were registering the plugin we are testing, including setting up appropriate Pre-Images and Post-Images.
  2. Manually create Contact to fire off the plugin. Validate that it functioned without error by checking the system jobs entity for a successful record of plugin execution
  3. On the server go to C:\windows\temp\ and look for a file with a named [Primary Entity] – [Message], where primary entity is the primary entity we registered the plugin against, and the message is the CRM 2011 plugin message. In our case contact-Create-001.xml
  4. Copy this file back to local development machine and into solution folders.

 

Testing Plugin

 

Go to Program.cs file and add the code like

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;
using CRM2011.Plugin; //Reference to Plugin project

using Engage.Util.PluginTester; //Test Plugin
namespace CRM2011.UnitTestingPlugin

{

class Program{

static void Main(string[] args)

{

//Service Provider object with the context information of the file

//which got created by serializing the objects passed to SerializePluginContext

MyServiceProvider provider = new MyServiceProvider(

"domain\username",

"pwd",

"http://servername/orgname/XRMServices/2011/Organization.svc",

@"contact-Create-001.xml");
//Create object to Plugin class which we are going to test

UpdateContactPhonePlugin plugin = new UpdateContactPhonePlugin();
//Call the execute method by passing the provider with context information

plugin.Execute(provider);

}

}

}

Set this project as the StartUp project and add the debugging point before running. There we are, got the break point…

 

 

When we are running this project this will be using the existing file as the context so this will not going to create records. This way we can test it for any number of times without creating/updating the records.

That’s it we are done.. Hope this helps 🙂