14 April 2007

Vista CRM Search Gadget

10/10/07 UPDATE: Please read this http://blogs.msdn.com/joris_kalz/archive/2007/10/10/Vista-CRM-Search-Gadget-_2D00_-Update.aspx too.

CRM-Friends! As promised here I wanted to update my multi entity search for Microsoft CRM by using a Windows Vista Gadgets. And here you go: This posting exists of two parts.

The first part is a small Windows Vista Gadget. Gadgets are easy-to-use mini programs that give you information at a glance and provide easy access to frequently used tools. This gadget allows you to find any information inside of Microsoft CRM.

The second part is the main search application which allows you to find information from multiple entities in Microsoft CRM. In this version you can search for accounts, contacts and leads at once. However, I tried to make it more generic so that you are able to customize it just by configuring a xml file.

 
The search application

Important: you have to install at least the search application, the Windows Vista Gadget is just a nice to have. But if you want to use the gadget, you have to install the search application first.

In addition, the search application provides you with IE7 search provider, so you can add this seach application to your favorite list of search engines in your Internet Explorer.

Adding this search application to the IE7 search providers


Now you can search from your Internet Explorer in Microsoft CRM

When pressing the search button in the IE search bar or in the gadget the search application will be opend in a new browser window:

From there you you get a list of all results containg your query. Just click on the result to open the full record in Microsoft CRM.

It's just that easy to find your desired accounts, contacts, leads etc. with just one click from your desktop!

How to install the seach application

First install the search application. You can download it here: Search Application.

  • Create a new ASP.NET 2.0 web application on your IIS.
  • Don't forget to configure a new application pool
  • Inside of it create a new virtual folder Search
  • Copy the content of the zip file into it. It should look like this:
  • Open the web.config with your notepad and edit the crmserver key to point to your crm server
	<appSettings>
		<add key="crmserver" value="192.168.1.211" />
	</appSettings>

How to install the gadget

When the search application is working you can download the gadget here: Vista CRM Search Gadget. The first time you are running the gadget you have to enter the search apllication url in the settings dialog.

The value should be http://[yourwebsite]/Search/ 

Please let me know if you have any comments or suggestions.

 Greetings Joris

 

Comments

# Microsoft Dynamics CRM @ Joris Kalz's WebLog said:

CRM-Friends! As promised I wanted to update my multi entity search for Microsoft CRM by using a Windows

15 April 07 at 6:41 PM
# Joris Kalz said:

Some questions and answers from a mail:

1. The gadget URL textbox doesn't allow enough characters. In my case, I needed to put the FQDN in and ran out of characters (http://xxxx.xxxxxxxxx.local/search). I got around it by adding a DNS suffix, but it might be nice to have some more room in there.

ANSWER: I have uploaded a new version, it is now extended to 256 chars.

2. What columns are you returning in the results? Can the search results have column headers?

ANSWER: I thought about to divide the result into multiple tables to make it more clear for the user what columns will be returned, maybe next version. However it is customizible by editing the config.xml file.

3. When I try to add the search to the list of IE 7 providers, I get the following error:

ANSWER: Unfortunately it is hardcoded. Look at Default.aspx Line 78:

<a href="#" onclick='window.external.AddSearchProvider("http://192.168.100.20/Search/SearchProvider.xml");'>

And change it to

<a href="#" onclick='window.external.AddSearchProvider("http://[yourwebsite]/Search/SearchProvider.xml");'>

16 April 07 at 5:42 AM
# Vali said:

Hello - crm search works like a charm - good job Joris

I have one hickup - it is only searching through leads - so it is not touching Opps and Accounts

Why?

Vali

16 April 07 at 10:48 AM
# Joris Kalz said:

@vali:

it should search in accounts, contacts and leads. open the config.xml to see which fields will be searched.

16 April 07 at 11:02 AM
# petergordon said:

when I perform a search I get this error. Is it a configuration issue on my part?

Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

Source Error:

Line 314:

Line 315:        // Execute the request.

Line 316:        RetrieveMultipleResponse principalResponse = (RetrieveMultipleResponse)service.Execute(retrievePrincipal);

Line 317:

Line 318:        return principalResponse.BusinessEntityCollection;

Source File: e:\inetpub\extensions\search\Default.aspx.cs    Line: 316

19 April 07 at 9:02 AM
# JochenG said:

@Vali:

The fact that it wasn't searching the Account had something to do with a minor bug in the add2DataTable method.

Just add following code to the catch block in the method and everything should work:

           catch (Exception)

           {

               if (dataRow != null && dataRow["id"] != null && dataRow["id"] != String.Empty)

               {

                   dataTable.Rows.Add(dataRow);

               }

           }

19 April 07 at 9:32 AM
# Joris Kalz said:

@petergordon:

please check if your web site for the search application is running in windows authentication mode.

@JochenG:

thanks a lot for your correction

19 April 07 at 4:28 PM
# Kuven said:

Hi there, really cool app.

CS0103: The name 'dataRow' does not exist in the current context

I get this error after adding the catch statement to the default.aspx.cs file. I am not a developer so please excuse. I get this when trying to fix the bug so that it may search through accounts.

Kevin

24 May 07 at 10:52 AM
# tsales314 said:

I got the same error...any ideas?

-T

30 May 07 at 12:30 AM
# A Freaky Microsoft Dynamics CRM Blog said:

I can now proudly announce that we will have the new Microsoft Dynamics CRM VPC available for download

12 June 07 at 4:34 AM
# loxer420 said:

I am trying to get this to work on my CRM 3.0 server and tried including the code above so that the searches would be more accurate, but am getting the same error "CS0103: The name 'dataRow' does not exist in the current context".

I noticed that it was searching on 4 fields in account by default, but that if one of the fields was empty, the application wouldn't return those items in the result.  Below is the same error but with a little more details.

Compiler Error Message: CS0103: The name 'dataRow' does not exist in the current context

Source Error:

Line 397:            catch (Exception)

Line 398:            {

Line 399:                if (dataRow != null && dataRow["id"] != null && dataRow["id"] != String.Empty)

Line 400:                {

Line 401:

Source File: c:\Inetpub\CRMSearch\Default.aspx.cs    Line: 399

My modified catch statement in Default.aspx.cs looks like this:

           catch (Exception)

           {

               if (dataRow != null && dataRow["id"] != null && dataRow["id"] != String.Empty)

               {

                   dataTable.Rows.Add(dataRow);

               }

           }

Am I doing something fundamentally wrong here?

20 June 07 at 4:58 PM
# dr3w2k said:

Is it possible to add the option to also search Cases? I have tried editing the config.xml file but I constantly get an error thrown on line 316:

Line 314:

Line 315:        // Execute the request.

Line 316:        RetrieveMultipleResponse principalResponse = (RetrieveMultipleResponse)service.Execute(retrievePrincipal);

Line 317:

Line 318:        return principalResponse.BusinessEntityCollection;

Here is the code I added to the config.xml file:

<entity name="case" guidcolumn="incidentid" icon="ico_16_4.gif" url="http://crm/CS/lcases/edit.aspx?id=" description="Leads">

<field name="ticketnumber" description="Ticket" />

<field name="CFSAccount" description="Account" />

<field name="title" description="Title" />

<field name="ownerid" description="Owner" />

</entity>

Any thoughts/suggestions?

07 August 07 at 4:42 PM
# Akezyt on MSDN said:

Introduction Microsoft CRM 3.0 shipped with an extensive web service API that can be used by various

07 August 07 at 6:55 PM
# TourismVI said:

I too am getting the CS0103: 'dataRow" does not exist error. What are we all doing wrong??

Compiler Error Message: CS0103: The name 'dataRow' does not exist in the current context

Source Error:

Line 397:            catch (Exception)

Line 398:            {

Line 399:                if (dataRow != null && dataRow["id"] != null && dataRow["id"] != String.Empty)

Line 400:

Line 401:               {

Source File: c:\Program Files\Microsoft CRM\Search\Default.aspx.cs    Line: 399

21 September 07 at 1:19 PM
# TourismVI said:

Also, did anybody else find that if you have too many results when using the Vista Gadget (more than about 10), the IE7 window that pops up cuts off the rest of the results? In other words there is no scroll bar. Any ideas how to fix this?

21 September 07 at 2:58 PM
# TourismVI said:

For all those struggling with the CS0103 error I have the solution! Move the following line from default.aspx.cs up ABOVE the try block.

DataRow dataRow = dataTable.NewRow();

In other words that add2DataTable should function should look like this:

private static void add2DataTable(ref DataTable dataTable, BusinessEntityCollection entityCollection)

   {

       // adding records

       for (int i = 0; i < entityCollection.BusinessEntities.Length; i++)

       {

           DynamicEntity dynamicEntity = (DynamicEntity)entityCollection.BusinessEntities[i];

   DataRow dataRow = dataTable.NewRow();

   try

           {

               dataRow["type"] = dynamicEntity.Name;

               dataRow["id"] = ((KeyProperty)dynamicEntity.Properties[0]).Value.Value;

               if (((StringProperty)dynamicEntity.Properties[1]).Value != null)

                   dataRow["field1"] = ((StringProperty)dynamicEntity.Properties[1]).Value;

               if (((StringProperty)dynamicEntity.Properties[2]).Value != null)

                   dataRow["field2"] = ((StringProperty)dynamicEntity.Properties[2]).Value;

               if (((StringProperty)dynamicEntity.Properties[3]).Value != null)

                   dataRow["field3"] = ((StringProperty)dynamicEntity.Properties[3]).Value;

               if (((StringProperty)dynamicEntity.Properties[4]).Value != null)

                   dataRow["field4"] = ((StringProperty)dynamicEntity.Properties[4]).Value;

               dataTable.Rows.Add(dataRow);

           }

           catch (Exception)

           {

            if (dataRow != null && dataRow["id"] != null && dataRow["id"] != String.Empty)

              {

                  dataTable.Rows.Add(dataRow);

              }

           }

       }

   }

04 October 07 at 5:25 PM
# Joris Kalz said:

TourismVI, Thank you very much for sharing your solution! I highly appreciate it!

Joris

10 October 07 at 4:53 AM
# Microsoft Dynamics CRM @ Joris Kalz's WebLog said:

If you haven't read about the Vista - Microsoft Dynamics CRM Search Gadget yet, please read this first:

10 October 07 at 5:04 AM
# Microsoft Dynamics CRM Team Blog said:

Joris Kalz is working as Partner Technical Specialist for Microsoft in Germany. He focuses on consulting,

19 October 07 at 10:37 AM
# Microsoft Dynamics CRM Team Blog said:

Joris Kalz is working as Partner Technical Specialist for Microsoft in Germany. He focuses on consulting,

25 October 07 at 10:05 AM
# Microsoft Dynamics CRM Norge said:

Nu har ytterligare en ny Vista Gadget dykt upp som gör det enkelt att söka igenom Microsoft CRM databasen

07 December 07 at 1:57 AM
# SviFi said:

Thank you very much for the script!

With modification listed in comments here it works great. In fact, maybe the source file could be also fixed a little to be up to date, considering what was noted in comments?

One question (getting back to what dr3w2k was asking, but wasn't answered): how easy is it to make it search in additional entities such as cases, articles, E-mails, Appointments?

Would it be a task of rewriting everything or just some small modifications?

Thank you very much again. I appreciate great work.

Vitaly Stockman

08 April 09 at 9:38 AM
Anonymous comments are disabled
Page view tracker