Friday, 21 December 2012

I recently hit this random error with the Microsoft AX Dynamics connector when try to configure the CRM org.

The following exception occurred while attempting to retrieve all
companies: Could not load type 'Microsoft.Xrm.Sdk.Client.IServiceManagement`1'
from assembly 'Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.All I did to fix it was move the Microsoft.Xrm.Sdk.dll from the C:\Program Files (x86)\Microsoft Dynamics\Microsoft Dynamics Adapter\Adapters\Microsoft.Dynamics.Integration.Adapters.Crm2011 folder and copy it into the root folder for the dynamics adapter install.It seems the installer may have not moved that required file and the configuration wizard is from within that folder.

Monday, 10 September 2012

It has been a long time since my last post, anyhow currently I'm at Tech Ed and I figured I would blog about a cool session I attended regarding CRM 2011 and tips and tricks.

Gayan Perera from Magnetism ran the session and mentioned a really cool generation tool to replace the crmsvcutil tool from the sdk. It has now been released on code plex and allows generation of code using templating, this is a lot more flexible than the current tool and easier to work with. Check it out here: http://crm2011codegen.codeplex.com/

The other cool information was turning managed solutions into unmanaged solutions using SQL, it makes the org unusable but if done on an import of a copied database the solution can be exported and imported where required.

declare @isManagedTables table (id int identity, name nvarchar(100))declare @count int, @currentTable nvarchar(100), @currentM bit, @currentS bit-- go through all the tables that have the ismanaged/solutionid flag, find the related records for the current solution and move them to the crm active solution.insert into @isManagedTables (name)select name from sysobjects where id in (select id from syscolumns where name in ('IsManaged')) and type='U'order by nameselect @count = count(*) from @isManagedTableswhile (@count > 0)beginselect @currentTable =name from @isManagedTables where id=@countselect @sql ='update ' + @currentTable + ' set IsManaged=0 where SolutionId=N''' + cast(@solutionId as nvarchar(100)) + ''''print (@sql)exec (@sql)select @count = @count -1, @currentTable = NULLend

declare @isSolutionIdTables table (id int identity, name nvarchar(100))insert into @isSolutionIdTables (name)select name from sysobjects where id in (select id from syscolumns where name in ('SolutionId')) and type='U' and name not in ('SolutionComponentBase') -- ignore this table because it doesn't make a difference. it does cause dependency errors on the exported solution but we can manually edit the xml for that.order by name

Saturday, 30 April 2011

If you install rollup 1 for CRM 2011 and suddenly notice that subgrids are no longer working for Windows XP machines, ensure that you have 'Enable native XMLHTTP support' turned on in the internet explorer settings.
The specific issue we noticed was just a Grey outline of where the subgrid should be and a js error when closing the form.

Wednesday, 20 April 2011

I strongly believe that out of the box features should be used for development where appropriate. My first post will show how to use the features of advanced find to display search results on a map.

If you are wanting the completed version of this just to install I will be putting this on codeplex for free download. Or you can download the managed and unmanaged solutions from below.http://crmmapping.codeplex.com

First thing that is needed is to add a button to the advanced find ribbon. The following XML copied into an exported customisations.xml file will provide a new Map button in the Show group in the MSCRM.AdvancedFind tab.

The CustomAction element contains the location reference to the advanced find tab show group, as noted by Mscrm.AdvancedFind.Groups.Show.Controls._children.
The Button element references the custom command defined in the CommandDefintions element and specifies the TemplateAlias, without the correct alias defined the button will not display.
The JavaScriptFunction references the method DisplayMap and the library in the webresources called boggle_AdvancedFindSearch.js.

The resulting button looks like this screenshot below:

The next thing that is needed is a way to process the results into a generic array for adding to a map. The following code has been added to a webresource named boggle_AdvancedFindSearch.js.

The method DisplayMap loads the fetchXml from the advanced find form and removes the attribute elements and adds the all-attributes element to ensure address fields are retrieved. The fetchxml is used for a retrievemultiple request by passing the fetchxml to the FetchResultsXml method. The results are then processed using the GetArrayFromFetchResults method to get the results in an easier to use form to be passed onto the map. The map window is then opened using the window.open method, the bing maps window will look at the var resultsArray to get the results retrieved from the advanced find.

The next part we need is an html webresource for displaying the bing maps with the results, here is the code that loads the required elements for the map.

The part that displays the result are in the javascript webresource named boggle_bingMapsJScript.js. This library adds pins to the map based on the addresses in the entities and centres on the last pin. The code for the library is below.