Wednesday, March 20, 2013

WCEM 2.0 - Search as you type modification

Within WCEM 2.0 by default the search-as-you-type will respond after typing 4 characters. This blog will give you a step-by-step guide to enhance this functionality.

The standard configuration for the search-as-you-type functionality will be triggered after typing 4 characters, and by default (with ERP as backend) will retrieve up to 5 hits. These settings can be found in the file generic-searchbackend-config.xml.

This file contains both CRM backend as well as ERP backend configuration. 

During our latest WCEM 2.0 project with ERP as backend, the functional requirement was that the search should start after 3 characters and retrieve up to 3 results.
Step 1

Find the XML file with the configuration. Within this file the following part will show the configuration for the search-as-you-type functionality. 


Here it shows that the maxHitsToSelect attribute has the value 5, resulting in the message "5 hits were returned". And the attribute startSearchRequestAfter has the value "numCharacters: 4".

Step 2

Create your own search-genericbackend-config.xml, for this project the file was created within the module Main in the BO part. 



Within this XML make the adjustements that will fit the requirement. In our case modifications were made for the two highlighted attributes. Note: these changes will be merged with the original SAP XML file.




Step 3

Add the custom created XML file to the metadata XML. This file can be found in the MD part of the module.




Within this file add the search-genericbackend-config.xml.




Set the namespace to customer (yellow highlight) and in this case the XML was created in the BO part (red highlight).

Step 4

Build and deploy and see the result.


Default
Custom

No comments:

Post a Comment