Understanding the Dedupe screens created by the Advanced Customization Wizard

2 minute read time.

A customer had a requirement to understand the way in which the Dedupe screens for a Custom Entity worked.

The customer had created a new entity that was the child of Companies and Persons and they had added the look up fields into the Dedupe screen for the custom entity as you can see in the screen below.

They found that the deduplication partially worked as conflicts with existing data would be shown (as below)

But if they then continued to enter the new entity, they found that not all the information they had entered into the orginal screen was carried across into the full entry page as you can see in the image below.

I hope that the rest of the article will explain why the Wizard created pages work like they do and what you would need to change to get them to work in the way you want them to work.

The insertion of a record for a new Custom Entity with deduplication 'enabled' uses 3 separate ASP pages, assuming the entity is called 'myEntity' these pages are:

  1. myEntity/myEntityDedupe.asp
  2. myEntity/myEntityConflict.asp
  3. myEntity/myEntityNew.asp

The fields that you add to the myEntityBoxDedupe will be displayed in the first screen (myEntityDedupe.asp).

The values that you have entered for your entity is be read in the conflict screen (myEntityConflict.asp) using the Request.Form() collection e.g. Request.Form("xxxx_companyid").

Note: By default the generated code for the ASP pages does not expect to have any more fields added to it. It just assumes that the default of the xxxx_name field is used.

You can see this in the code of the myEntityConflict page look for

[code language="javascript"]
sPOST = sPOST + " &fieldname" + "=" + sField;
sPOST = sPOST + " &fieldval" + "=" + sValForm;
[/code]

"sPost" is a variable that is then added to the URL when the page is redirected to the myEntityNew.asp page, look for the code that looks like this (my new entity was called Project)

[code language="javascript"]
Response.Redirect(CRM.URL("Project/ProjectNew.asp") + sPOST + " &E=Project &context="+context);
[/code]

The code of the new Page (myEntityNew.asp ) will then look for the two name value pairs (fieldname & fieldval) in the Request.QueryString

e.g.

[code language="javascript"]
names = Request.QueryString("fieldname");
if( Defined(names) )
{
vals = Request.QueryString("fieldval");
//get values from dedupe box
for( i = 1; i
{
Entry = EntryGroup.GetEntry(names(i));
if( Entry != null )
Entry.DefaultValue = vals(i);
}
}
[/code]

If you want to include other values in the Dedupe screens then you will need to the alter the code of 2 of the 3 pages involved

  • myEntity/myEntityConflict.asp
  • myEntity/myEntityNew.asp

I hope this will help you customize the dedupe behaviour for custom entities.