You need to sign in to do that
Don't have an account?
Kiru535
List out Duplicate records on account object like Lead object
I got requirement like on Account detail record create one button called "Find Duplicates".When click on this button invoke the VF page to display the list of duplicate record matching with the current record.
I am dng the account matching based on Account name,website, Country,City
Please help me ASAP how to do with Apex class and VF page.....
Regards,
Kiran
Hi Kiran,
You have to put soql query on Account objent in your controller and put where condition as per your requirement(matching based on Account name,website, Country,City). after this you will get List of Account Record. now using pageblocktable you can display this Account record to Visualforce Page.
Important :
If this answer is helpful to you, please mark this as the best answer.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
Thanks for the reply...
My code is working fine but with small issue... When I click on Find Duplicate Button on account detail dispalying the current record in VF page even if doesn't match the duplicates. And I want code like If Account list.Size()>=1 return to VF page otherwise show the Apex message like " No Duplicates found related to this record".
Please post me the code to achive this scenario.
Controller:
public class AccountDupController
{
Account acc;
String acname;
String web;
List<Account> accountStd;
public List<Account> searchResults {get;set;}
private ApexPages.StandardController controller {get;set;}
public AccountDupController(ApexPages.StandardController controller) {
//initialize the stanrdard controller
this.controller = controller;
this.acc = (Account)controller.getRecord();
accountStd = [SELECT Name,Website FROM Account where ID=:acc.id];
acname = accountStd[0].Name;
system.debug ('***** Name is*****'+acname);
web = accountStd[0].Website;
system.debug ('***** Name is*****'+web);
}
public PageReference search()
{
searchResults =[SELECT Name,Website FROM Account where Name=:acname AND Website=:web];
system.debug('*****The results*****'+searchResults);
return null;
}
}
VF page:
<apex:page standardController="Account" extensions="AccountDupController" action="{!search}">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Results" id="searchResults" columns="1">
<apex:pageBlockTable value="{!searchResults}" var="o">
<apex:column headerValue="Account Name">
<apex:outputLink value="/{!o.id}" target="Account">{!o.Name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Website"/>
<apex:column value="{!o.Website}">
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi kiran,
Here is your code.
Visualforce Page:
Apex Class:
Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
i found the errors "list index out of bound expection " at line 13 and 15 can you please say how to slove the problem
thanks
I am dng the lead matching based on First name,Lastname, company,Email.
Please help me ASAP how to do with Apex class and VF page.....
Thanks