Customize Contact Merge: Combine search results from different data sources
May 2021. MetaDirectory 5 Enterprise
Often, data on the same contact is stored in parallel in different data sources. For example, order-related data for a contact is stored in an ERP system, support data in a ticket system, and general and marketing data in a CRM system. The new MetaDirectory web portal now offers the option of displaying this data in a single search result. By activating the "Contact Merge" feature, contacts with the same e-mail address or the same SIP address are automatically merged and all information is displayed as one contact.
The criteria that lead to merging of contacts can be freely defined on the MetaDirectory server.
Example of a search result with and without Contact Merge
Here you can see how search results are displayed using an example with two contacts with the same postal code (here in the example fictitiously the 9999).
Example Screenshot: MetaDirectory Administrator – database query – database search
Without Contact Merge
In this example, two different contacts are delivered via the web search – without Contact Merge:
With active Contact Merge
With Contact Merge active, the web interface now displays the following:
Example screenshot: Search by postal code in the web interface – with active Contact merge
Example screenshot: Search by postal code in the web interface – with active Contact merge – found entries
Procedure
The configuration is done via e3_merge.js in the MetaDirectory installation directory:
C:\Program Files\estos\MetaDirectory\wwwroot
Referenced fields
Now it also depends on which field is to be referenced in the contact.
One field
If a field is used that exists only once (in the following example the field "postalCode"), the following code is sufficient:
function fnMergeMatch(jsnContactA, jsnContactB)
{
return (jsnContactA.postalCode == jsnContactB.postalCode);}
Download example .js file
Multiple fields
If multiple matches are to be made, e.g. for multiple e-mail address fields for one mail address field (of which there are three different ones), the code should look like this:
function fnMergeMatch(jsnContactA, jsnContactB)
{
return (jsnContactA.mail == jsnContactB.mail || jsnContactA.mail2 == jsnContactB.mail2 || jsnContactA.mail3 == jsnContactB.mail3);
}