Guest blogger and CRM MVP Leon Tribe shares with us his one of his favorite customizations for the Microsoft Dynamics CRM product. Leon is a CRM consultant and trainer who also blogs prolifically at Leon’s CRM Musings.
About a month ago I gate crashed Cloudforce, the Salesforce promotional roadshow. When I was not on their booths showing off Microsoft Dynamics CRM, I was attending sessions seeing what they had to offer. One feature, which made me jealous, was their universal search. For quite a while now Dynamics CRM users have been asking for the ability to search across multiple records at once but short of getting SharePoint into the mix, buying an add-on or coding a solution it was not possible.
This got me thinking whether it would be possible to create a universal search using what we have available through codeless configuration. It turns out it is possible, costs nothing and is reasonably usable.
The solution presented is designed for CRM 2011, although it is possible to create a similar solution for version 4. To see the details of the version 4 solution, check out my blog article (http://leontribe.blogspot.com/2011/06/codeless-universal-search-for-dynamics.html)
What Does It Look Like?
Here is the end result:
You type into the quick search the string you want to search on and the results come back. In this case I was looking for Yvonne and got two hits; a lead and a contact. From the results I can now click through to the records.
How Does It Work?
The first step in putting this together is to create a new entity called ‘Universal Search’.
To this entity we add 1:N relationships to the entities we want to search on and a ‘keywords’ field. The keywords field will get populated by the values of the fields we want to search on for each entity. For example, for a contact entity we might want to search on first name, last name and full name. Here is an example of setting up a relationship with the account entity.
One thing to notice here is I have turned off the Display Option for ‘Navigation Pane Item for Primary Entity’. In this case, on the account form you will be able to look up the universal search entity but there will be nothing on the universal search side to indicate a relationship. The only reference to the account will be via the ‘regarding’ field. While this step is not essential, it does mean a ‘cleaner’ solution as showing of the accounts on the left hand side of the universal search record is not needed.
Here is the Lead record for Orlando to give you the idea of the keywords field.
You can add any CRM entity which allows workflows to be run against them, can have activities associated to it and which can be part of a N:1 relationship.
Now we have the structure in place we need to add some workflows.
The first workflow creates a universal search record every time an account is created (or whichever entity you want to search on).
In the universal search record we populate the Subject, the keywords field (a new ‘multiple lines of text’ field to hold the key words we will search on) with the Account values of interest e.g. Account Name, Account Number and we add a link back to the Account in the regarding field.
In the second step of the workflow we then update the Account to link back to the Universal Search record through its lookup.
To reference the record you have created in the previous step, you drop down the ‘Look For’ in the Form Assistant, as in the diagram.
In this case I have added the Universal Search lookup field to the account form but this is not necessary as workflow allows you to populate fields which are not on the form (you just scroll down the form to the Additional Fields area).
The second workflow updates the Universal Search record if details on the Account change.
In this case we trigger off of a change in the key fields on the Account (Account Name, Account Number). We then update the Universal Search with the new information, populating the same fields as our first workflow, with the same values.
You may have noticed that both workflows are marked as on-demand. In the case of the first workflow, this is needed if you have old records which you want to create Universal Search entries for. In the case of the second workflow, this is necessary if you change the fields you want it to search on as you then have to run it across all the records in the system to update the keywords that will be picked up. Incidentally, if you do adjust the fields you are searching on, remember to reflect this in three places; the create step of the first workflow, the trigger fields in the second workflow and the update fields in the second workflow.
Performing The Search
Once you have performed these steps for all the entities you wish to search on, all you need to do is adjust the Quick Find view of the Universal Search to use the keyword field as the Find Field and add the regarding field to the View Fields and you are ready to go. To search you will need to go to Workplace-Activities and then change the view to the default Universal Search view.
Making It A Standalone Search Box
Getting to the ‘search screen’ can be a little inconvenient so something you can do is make it a shortcut outside of CRM which you can have as a favourite in Internet Explorer or a shortcut on your desktop.
To do this, firstly browse to the default view for the new entity.
You will see at the top you can ‘Copy a Link’. If you select the little black triangle next to this, it lets you copy a web link to this view. I was getting an error when I tried this online so, if it fails, use the ‘E-mail a Link’ instead and copy just the web address part. Open up a blank web page, copy in the link to see if it works and if it does add it to your favourites (or your desktop as a shortcut etc.)
First of all thanks go to fellow Dynamics CRM MVP George Doubinski for suggesting the use of a custom activity entity over a normal entity and making use of the activity ‘Regarding’ field. This approach is much more elegant than my original ‘version 4’ approach.
Probably the biggest downside with this solution is the back end maintenance. If you implement this after the records have been created, you will need to run the first workflow against all the old records in the system. Also, if you change your mind about the fields you are searching on, you need to adjust the workflows in three places and run the second workflow against all relevant records. In a database with a large amount of records, this may be inconvenient.
On the plus side, this works in CRM 2011 (with a non-activity based version for CRM 4), is codeless, free, works on most entities, including custom ones, and can be set up in an hour or two.
While this solution works and is fully supported, if you are looking for something a bit more ‘commercial’, there are paid solutions which perform a similar job. To explore these, go to the CRM Search Solutions in the MarketPlace.