How to search for multiple values and fields using Quick Find...
There is one very common requirement for CRM 3.0 and question that users ask - how to look for multiple values at the same time using "Quick Find" view. Unfortunately the answer is - you cannot do it by default in Dynamics CRM :-(.
However, there is a workaround (or trick, if you like ;-) ) that can be used whenever users want to search for multiple fields and values at one time, using the "Quick Find" view. It is not very simple (and quite challenging to extend), but makes searching for multiple values possible and can really help users. The trick uses an additional field to store all the values that we would like to search on in one field and then use callouts to update this field with relevant values. This post requires one to possess the knowledge how to create callouts and how to make simple customizations.
Here are the steps to achieve that funcitonality:
- First, we have to decide for which values we want to search simultaneously. In this example, we are going to enable simultanous search on Full name, Security number and the City from the Contact entity
This is a very important step, because we will have to customize the callouts in a proper way and set the field length to a proper value. - Then, we create a new field for the entity that will be searched, using Quick Find. In this example, we will call it new_alldatasearch
This field will aggregate the content from the fields that we would like to use when searching for multiple values. So, its data type should be nvarchar and its length be at least as big as aggregated length of all the fields we want to search on- Go to "Settings" tab, and then to "Customization", "Customize Entities"
- Select which entity will allow to search for multiple values (in our example, we use Contact entity)
- Add a new field
- Having added the new field, we have to guarantee that this field contains data from all the fields we would like to serch for simultaneously. For this purpose we have to create 2 callouts for this entity. First callout should be triggered before we add a new record (so, this will be a PreCreate callout). This will guarantee that when a new object is created, the values from all the proper fields are in one field (so that "Quick Find" view is able to search for these values). The second callout code should be run to update the values in the new_alldatasearch whenever the user changes these values.
For the reference how to create callout, please refer to CRM SDK - The best way to update the new_alldatasearch field is to write values from all the relevant fields to it with using a white space as a separator. This will allow the "Quick Find" view to find the values
- Have we guaranteed that the new field always contains the right data, we have to instruct the "Quick Find" view to search in our new field for the values the the user enter. To accomplish this, we go to "Settings" tab, "Customization" and then choose the entity that we would like to use to search for multiple values.
- Now we have to add our new field new_alldatasearch to "Find columns" in the Quick Find view.
- After we publish our customizations we are ready to search for multiple values at the same time using the "Quick Find" view!
We may use the (*) wildcard in our search, but we have to remember that due to the way the "Quick Find" works, we have to specify the values in a particular order. If we don't care for specific value, we should use the star (*).
Please note that this is only a workaround and it requires some deeper knowledge on Dynamics CRM customization. It also requires the end users to comply with some imposed ways to look for the values