Wednesday, November 13, 2013

Clear Integration of MS Dynamics CRM2011 to SharePoint

MS has provided good integration point on MS Dynamics CRM with SharePoint document management. In order to integrate SharePoint document management with Dynamics CRM, you must install CRM List Component on SharePoint and configure Dynamics CRM for SharePoint. I am not going to cover those two tasks from this article and please follow below two articles to complete those two tasks.

1. Introduction to SharePoint Integration with Microsoft Dynamics CRM
2. MS CRM 2011 SharePoint List Component Installation

Even though integration was done fairly well, I encountered that there are few issues with that integration and they are:


1. If the primary field of the entity record has no value set, integration to SharePoint document management will be broken for particular record and CRM throws an error with message "Both absolute URL and relative URL cannot be null". It shows that error just because of value of primary field is used create relative URL(folder name in SharePoint Document Library created for the entity) for holding documents saved for particular entity record and it cannot have blank value.

2. If there are two records with same primary field value (e.g. two contacts with same name) in CRM, documents saved will be shared with both the records.

In order to fix above two issues I have come up with solution and thought it will be beneficial for others as well.


We can create common plugin, which can be registered with any entity that you need SP document management enabled and do below tasks within create method of a plugin to fix above issues. Concept behind the solution is, plugin will create SP document location in CRM and folder in SP up-front, when the CRM record is created. So then when you click on Documents link in CRM record, CRM won't try to create SP document location using value in primary fields and use the detail of a record that have been created by plugin already.

1. Get Sharepoint Parent Site LocationId in CRM using default SP site URL and target entity name.

Guid sharepointParentSiteorLocationId = GetSharepointParentSiteorLocationIdByEntity(orgServiceContext, sharePointURL, target.LogicalName);

2. Create SP folder up-front. Folder name will be GUID of a target entity record.

CreateSubFolder(sharePointInternalURL, target.LogicalName, target.Id.ToString());

3. Create SP document location in CRM. CRM will use these detail to point to a correct location of SP.

CreateSharePointDocLocation(orgServiceContext, target.LogicalName, target.Id, sharepointParentSiteorLocationId, target.Id.ToString());

If you have any question or suggestions on this please feel free to post a comment below.


Tuesday, August 13, 2013

CRM 2011/2013 Custom Validation tool is not loading web resources.

CRM 2011/2013 Custom Validation tool is not loading web resources if the content of any of the web resource is blank. Thanks Linna to find  the issue.


Update FetchXML and Refresh sub grid in supported way on rollup 12 and later

Below function can be used to change the fetch XML and refresh the Grid control. This is 100% tested and working without an issue with even latest UR 14 on IE, Chrome and Firefox. I haven't access the DOM directly here since it is not supported.

function PopulateGridFetchXML(sourceFunctionName, subGridName, fetchXML) {
    var subGrid = Xrm.Page.getControl(subGridName);
    if (subGrid._control.get_innerControl() == null) {
            setTimeout(sourceFunctionName, 1000);
    subGrid._control.get_innerControl().SetParameter("fetchXml", fetchXML);
    // Refresh the grid


Tuesday, June 18, 2013

Duplicate views in List of Activity views in Microsoft Dynamics CRM 2011 (to be used asynchronously),

When you imported CRM solutions into  any environment, you might see that activity views have been duplicated.

Below article will show you how to fix that duplicate issue.

--Thsuhara M--

Wednesday, February 22, 2012

Fetch XML Builder for CRM 2011.

Many of the MS Dynamic CRM 4.0 lovers used handy Fetch XML Builder to generate complex fetch XML quires to retrieve the data. So those developers  dreams for having a version of fetch XML builder, which supports for CRM 2011.

Why it doesn’t support for CRM 2011, if the CRM web service is still available in CRM 2011 for backward compatibility? Developers tend to think that it doesn’t support, when they get below run time error.

You get above runtime error since you are running Fetch XML builder probably in 64 bit CRM server or 64 bit CRM development machine. Fetch XML builder installation is shipped with 32 bit CRM 4.0 SDK dlls and not 64 bit dlls. So in order to fix above run time error, you just need to replace 32 bit SDK dlls in Fetch XML builder installation folder from 64 bit SDK dlls, which can be found at CRM 4.0 SDK.

Using fetch XML to write complex queries is still a good option since execution of complex query may be 100 times faster than complex CRM LINQ query, which returns same result and Fetch XML can still be executed using Organization Service introduced on CRM 2011. And also it supports outer join, where outer join in CRM LINQ query is not straight forward.

Would you like to try Fetch XML builder for CRM 2011? if yes here we go..
1.       Download Fetch XML builder from Fetch XML Builder and install it on your local machine or a server.
2.       If you need a key please drop me your email and I will send you a key.
3.       If your machine is 64 bit, Replace 32 bit CRM 4.0 SDK dlls,which can be found at Fetch XML builder installation folder, from 64 bit SDK dlls and you can download 64 bit CRM 4.0 SDK dlls from my share(64 bit SDK dlls)

Are you a Dynamic CRM Fetch XML Builder? I am..

--Thushara Manchanayake--

Tuesday, February 14, 2012

How CRM 2011 handles Max Length of text field.

When we increase Max Length of text field and click save at field customization area, it alter relevant column in CRM back end (SQL server) and we don’t even need to publish customization. But when we decreased Max Length of a field, it affects to CRM front end only and not in back end SQL server. So SQL Server holds the increased length as it was. It means that you can save text, which is not allowed enter in CRM front end, using SDK.

 --Thushara Manchanayake--

Monday, January 23, 2012

Discovery service URL is not for CRM online anymore

“An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.”

When you used to connect into CRM online to register plugin, you will get above error message and you may end up with no solution to fix this issue. There are many blogs and troubleshooting items in MSDN to fix this issue and none of them will help you now with latest CRM online environment. I couldn’t find any blog related to this new issue and found the solution myself. There are many blogs created in last year, which may mislead you now since they tell you to use  as discovery URL to connect into CRM online.

Actually those blogs are not valid any more. With latest MS CRM online, we must use URL, which is used to browse CRM using browser that is https://<OrganizationName>

--Thushara Manchanayake--