<apex:page standardController="Contact" extensions="TestPopup" showHeader="false" sidebar="false">

<apex:form >
<apex:pageBlock >
<apex:commandButton value="show popup" action="{!showPopup}" rerender="popup" status="status"/>

              <apex:outputPanel id="popup">

            <apex:outputPanel id="popInnerOutputPnl" styleClass="customPopup" layout="block" rendered="{!displayPopUp}">
                 <apex:commandButton value="X" title="Close the popup" action="{!closePopup}" styleClass="closeButton" rerender="popup">
                 <apex:pageblockSection >                         

                     <apex:pageblockSectionItem >
                      <apex:outputLabel value="Email" for="address"></apex:outputLabel>
                             <apex:inputText value="{!searchstring}" label="Input"/>   
                 <!--apex:commandButton value="Ok" action="{!redirectPopup}" styleClass="closeButton" rerender="popup"-->
                 <apex:commandButton value="Search" action="{!Search}" styleClass="closeButton" reRender="popup">
            <apex:pageblockTable var="con" value="{!contact}">
          <apex:column value="{!con.FirstName}"/>
          <apex:column value="{!con.LastName}"/>
           <apex:column value="{!con.Email}"/>
           <apex:column value="{!con.Account.Name}"/>




                  <style type="text/css">
.customPopup {
    background-color: white;
    border-style: solid;
    border-width: 2px;
    left: 20%;
    padding: 10px;
    position: absolute;
    z-index: 9999;
    /* These are the 3 css properties you will need to tweak so the pop 
                            up displays in the center of the screen. First set the width. Then set 
                            margin-left to negative half of what the width is. You can also add 
                            the height property for a fixed size pop up.*/
    width: 500px;
    top: 20%;

.disabledTextBox {
    background-color: white;
    border: 1px solid;
    color: black;
    cursor: default;
    width: 90px;
    display: table;
    padding: 2px 1px;

.closeButton {
    float: right;


==================== CONTROLCLASS::::

public with sharing class TestPopup {

    public Boolean displayPopup {get;set;}
    public list<contact> contact {get;set;}
     public string searchstring {get;set;}  
  //  public string Email { get; set; }

    public TestPopup(ApexPages.StandardController controller) {


    public TestPopup (){
   // contact  = new list<Contact>();


    public void showPopup()

    displayPopup = true;


    public void closePopup() {
        displayPopup = false;


    public PageReference redirectPopup()
    displayPopup = false;
        //Please uncomment below 3 statements and replace YourObjectId
       // PageReference p=new Pagereference('/'+YourObjectId);
       //  p.setRedirect(true);
         return null;


    public PageReference Search(){
    displayPopup = false;
    //searched = true;
    string searchquery='select firstName,LastName,id,Account.Name,email from Contact where email like \'%'+searchstring+'%\' Limit 20';  
     contact= Database.query(searchquery);  
     system.debug('record is---->' +contact);
        return null;

  • You should be more specific to your problem. Add a description of what you did and where you are facing the issue. – Santanu Halder Oct 19 '16 at 9:50
  • Delete all the duplicate Contact records so that the Parent Account has only unique Contact records after deletion process – HKV Oct 19 '16 at 10:01
  • 1. A window pops up to the Business User once clicked the Business User can insert the Email address of the contact would like to merge or delete. 2. Search all Contact records associated with the Email address (within the same account) 3. Delete all the duplicate Contact records so that the Parent Account has only unique Contact records after deletion process 4. For the primary contact, ensure to update the Status field to ‘Cleansed’ – HKV Oct 19 '16 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.