Sunday, August 14, 2011

How to break linked reports in CRM 2011

Crm Exception: Message: Linked reports cannot be downloaded, ErrorCode: -2147220970


If you are finding that linked reports are failing to display in CRM 2011, and you get the old "Unexpected Error" message and when you look at CRM's tracing you find the message above, check that you have not removed the "Report Type" field from any of the Reports views.

It seems that the CRM team are using this column to launch linked reports and without it when a report is launched will go to link to download.aspx instead of the specified page.

Saturday, July 30, 2011

CRM 2011, Silverlight and Refresh Issue

When I added a Silverlight 4.0 application to a CRM form, I discovered a problem when you referesh the page in the browser. The issue is that on refresh the Silverlight application is ready before the Xrm.Page.ui is loaded and ready to access from Silverlight.

This was a major problem for me as I needed to know what CRM Form Type was, which is done by invoking the "getFormType" method on the Xrm.Page.iu property of the form.

After trying a number of things, I found the only way to reliably access the form type was to attempt to keep accessing form type until a value was succesfully returned.

So, for those interested, here's a snipped from my silverlight application which might help you:

            // To get around problem that form may not yet be full loaded
// and so javascript can't be invoked yet, keep trying until
// we can get the form type, waiting a second between each try.
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 1);
timer.Tick += (object s, EventArgs args) =>
{
int? formType = null;

// Attempt to get the Form Type
try { formType = CrmUtility.GetFormType(); }
catch { }

if (formType != null)
{
timer.Stop();

if (formType == 2) // 2 = Update
{
// ... Do work here ...
}
}
};
timer.Start();


Note that all GetFormType() method does is find the Xrm.Page.ui property and then calls .Invoke("getFormType") to get the current Form Mode from the regular Crm Javascript methods.

Also, you would expect this code to go somewhere in the initialization of your Silverlight Application.

Sunday, June 5, 2011

CRM 2011 : The given plugin assembly source type is not supported for isolated plugin assemblies.



The given plugin assembly source type is not supported for isolated plugin assemblies.


If you are getting this error message, it's because you are trying to register an assembly as sand boxed but have it's location set to disk or GAC. This is not an allowed combination, instead if you need it to be sand boxed set the storage location to the database.




Saturday, April 9, 2011

Running CRM 4.0 App on CRM 2011 Server

I came accross an issue running software on a CRM 2011 server that was designed for CRM 4.0. There error that was reported is as follows:

Could not load file or assembly 'Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


I was quite surprised to get this after being told by the CRM 2011 SDK that software targeting CRM 4.0 should still be compatible.

After lookin at this link it seems that the CRM 2011 installation is forwarding any reference to the CRM 4.0 assembly to the CRM 2011 assembly via a publisher policy - which aren't 100% compatible.

Although you can get around it by modifying your applications config file (which is described in the link above), this issue can also be fixed now by applying Rollup Pack 1 as indicated in the notes for the Rollup Pack:

The Microsoft.Crm.Sdk.dll file has an incorrect publisher policy registered in the global assembly cache (GAC). Therefore, when you use an application that is built with this dependency, the application fails in Microsoft Dynamics CRM 2011 Server.


Good to know if you intend to run software that was designed for CRM 4.0 on a CRM 2011 server.

Monday, February 28, 2011

Windows 2008 Server Domain Controller - Change Password Settings

Having built a lot of Virtual Development Environments with Windows server 2008 and CRM, one thing that I always have to lookup is how to disable the annoying password settings so that the password doesn't have to be reset every 42 days.

Setting this is not so straight forward, so below are the instructions on how to do this successfully on a Windows 2008 Server that is setup as a domain controller.

1. Start --> All Programs --> Group Policy Management

2. Expand Forest --> Domains --> (your domain)

3. Right click on Default Domain Policy and Select "edit..."



4. Expand Policies --> Windows Settings --> Security Settings --> Account Policies

5. Inside Password Polcies you will find all the relavent password settings.



6. Setting Maximum password age to 0 will disable password expiry.

7. Exit out and in the command line run "gpupdate.exe"

Now you should be good to go :)

Monday, February 14, 2011

CRM 4.0 SiteMap.xml and "Object doesn't support this property or method" error.

Today I came across an unusual error where a custom SiteMap SubArea (mapping to a URL) entry was causing an "Object doesn't support this property or method" when the user was navigating to the other subareas in the sitemap configuration in the same page.

Eventually I found out the SubArea's parent Group had the same ID, and this was causing the issue. Simply changing the Id's fixed the error. (Would have been nice to have an error that was raised somewhere which indicated this, but such is life.)

I hope this saves someone some agony out there!

Monday, January 17, 2011

How to check where your CRM 4.0 Plugin is being called from

Recently, I needed to figure out if a CRM 4.0 Plugin was being called from CRM or whether it was being called from the CRM API.

Luckily, the context provides this information through the context.CallerOrigin property. You can use this to determine whether the plugin is being called by comparing the type of the property to the following types:

if(context.CallerOrigin Is ApplicationOrigin) // It's being called from the CRM Web Application

if(context.CallerOrigin Is AsyncServiceOrigin) // It's being called from the Async Process

If(context.CallerOrigin Is WebServiceApiOrigin) // It's being called from external to CRM Via Web Services.


So there you have it...