I would like to modify the fields displayed in the Inline Duplicates Visualforce page for one of the standard objects (Accounts, Contacts, or Leads). How can I accomplish this?
- The default Visualforce pages that ship with the application cannot be modified as they are part of the managed package.
- Custom Visualforce pages can be created and used in place of the default pages allowing the fields displayed to be modified to the user's preference
- Both Standard and Custom fields can be added
- Existing fields can be removed
- A custom Apex Class (to update the field selections) and Visualforce page (to display the selected fields) will need to be created
- Sample code for the Apex Class and Visualforce pages are attached (file extension .cls is the class code, and file extension .page is the Visualforce page code).
- The files can be opened in either Notepad or Notepad++ and the code can then be copied and pasted directly into the Salesforce User Interface.
NOTE: This example is for Accounts, but the steps are the same for Contacts and Leads (using the appropriate attached files).
1. Create the Apex Class
- Navigate to: Setup -> App Setup -> Develop -> Apex Classes -> New
- Paste in the code from the Custom_DB_DuplicateAccountsList.cls (attached document)
- Update the SOQL select statement starting on Line 30 to include all the desired fields (or to remove fields).
- The following example shows the select modified to also include the Type from the Account object.
dupes = [SELECT CRMfusionDBR101__Account__c, CRMfusionDBR101__Account__r.Name,
FROM CRMfusionDBR101__Potential_Duplicate__c WHERE CRMfusionDBR101__Duplicate_Warning__c IN :warnings AND
CRMfusionDBR101__Account__c != null AND CRMfusionDBR101__Account__c != :account.id
ORDER BY CRMfusionDBR101__Duplicate_Warning__r.Name DESC, CreatedDate DESC LIMIT 200];
2. Create the Visualforce Page:
- Navigate to: Setup -> App Setup -> Develop -> Pages -> New
- Label: Custom_DB_DuplicateAccountsList
- Name: Will default to the same as above
- Paste the code from the Custom_DB_DuplicateAccountsList.page (attached document)
- Add the following code block for each added field
- There are 4 lines of code per field, this example shows the code that was added for the Account Type field.
<apex:facet name="header">Account Type</apex:facet>
3. Click Save, and then update the Page Layout to include this custom Visualforce Page (vs. the default page).
NOTE: Enable Apex Class Access for desired non admin user profiles. Setup -> Develop -> Apex Class, locate the created class, click security and add profiles. The custom Visualforce page will also need to be enabled for any non-admin Salesforce profiles.
More information on adding inline duplicates page for accounts, contacts, leads can be found here.