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 (23)

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

  2. Joris Kalz says:

    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&quot;);’>

    And change it to

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

  3. Vali says:

    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

  4. Joris Kalz says:

    @vali:

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

  5. petergordon says:

    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:inetpubextensionssearchDefault.aspx.cs    Line: 316

  6. JochenG says:

    @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);

                   }

               }

  7. Joris Kalz says:

    @petergordon:

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

    @JochenG:

    thanks a lot for your correction

  8. Kuven says:

    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

  9. tsales314 says:

    I got the same error…any ideas?

    -T

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

  11. loxer420 says:

    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:InetpubCRMSearchDefault.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?

  12. dr3w2k says:

    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=&quot; 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?

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

  14. TourismVI says:

    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 FilesMicrosoft CRMSearchDefault.aspx.cs    Line: 399

  15. TourismVI says:

    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?

  16. TourismVI says:

    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);

                  }

               }

           }

       }

  17. Joris Kalz says:

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

    Joris

  18. If you haven’t read about the Vista – Microsoft Dynamics CRM Search Gadget yet, please read this first:

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

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

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

  22. SviFi says:

    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

  23. Hi.

    I'm interested in the web search engine for our CRM 4.0 RU14 environment, but the files are no longer available.

    Could you please let me know where I can find them?

    many thanks