About a month ago I gate crashed Cloudforce, the Salesforce promotional roadshow. When I was not on their booths showing off Dynamics CRM (http://twitpic.com/4wh1cq) 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 is 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 and actually reasonably usable. Moreover, while the solution is built on CRM 2011, I can see no reason why you could not build the same thing in CRM 4.
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’.
I left the ‘Connections’ tick box ticked but it does not need to be. Similarly, Duplicate Detection can be turned off.
You will now need to create a 1:N and N:1 relationship to each entity you want to search on.
The thing to notice here is I have turned off the Display Option for ‘Navigation Pane Item for Primary Entity’. Doing this for both the 1:N and N:1 relationship results in the creation of a pseudo 1:1 relationship between the Universal Search entity and, in this case, the Account entity. On the form you will be able to look up the other entity but there will be nothing on the side to indicate a relationship.
Here is the Lead record for Yvonne to give you the idea.
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 Name, 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 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.
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 include the keyword field as a Find Field and add the lookups to the entities you are searching on to the View Fields and you are ready to go. You can add any CRM entity which allows workflows to be run against them and which can be part of a 1:N and N:1 relationship.
As with other codeless solutions, the result is a little clunky but very usable. Probably the biggest downside with this one 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 you 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 2011 (and probably v4), is codeless and can be set up in an hour or two. I guarantee that a coded solution cannot get near that kind of turnaround.