+ Start a Discussion
shoba shobashoba shoba 

Display the popup window in Account Page

Hi my scenario is to display the popup window(In this i want to display related contacts) , if the account address is updated.  I tried this using jquery its not showing the popup in the account detail page. Can anyone help me out to show popup window in the account page itself.
public class testforoverridingsave 
{  
  public Id accId{get; set;}
  public final Account oldRecord;   
  public static Account newRecord;           
  public testforoverridingsave(ApexPages.StandardController controller) 
  {
    accId = ApexPages.CurrentPage().getparameters().get('id'); 
    oldRecord = [select Id, BillingStreet, BillingCity, BillingState, BillingCountry, BillingPostalCode from Account where Id =: accId];     
  }
  
  public PageReference isAddressChanged()
  {
    Boolean changed = false;
    newRecord = [select Id, BillingStreet, BillingCity, BillingState, BillingCountry, BillingPostalCode from Account where Id =: accId]; 
    If(oldRecord.BillingStreet != newRecord.BillingStreet || oldRecord.BillingCity != newRecord.BillingCity 
       || oldRecord.BillingState != newRecord.BillingState || oldRecord.BillingCountry != newRecord.BillingCountry
       || oldRecord.BillingPostalCode != newRecord.BillingPostalCode)
      changed = true;
    
    return changed?new PageReference('/apex/WrapperClass?accountId=' + newRecord.Id):new PageReference('/' + newRecord.Id);    
  }
}


<apex:page standardController="Account" extensions="testforoverridingsave">
 <apex:includescript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"/>
 <script type="text/javascript">

 
  function redirectFunction()
  {
    var myWindow = window.open(addressChanged(),'','width=20000,height=20000,top=1000,left=550'); 
    
  }
  
 </script>
 <apex:form id="form">
  <apex:actionFunction action="{!isAddressChanged}" name="addressChanged" />
  <apex:actionFunction action="{!isAddressChanged}" name="addressChanged" />
 </apex:form>
 <apex:detail inlineEdit="true" showChatter="true" oncomplete="redirectFunction()" />
</apex:page>
Thanks Inadvance
 
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for pop-up
1) http://amitsalesforce.blogspot.in/2015/07/custom-popup-in-salesforce-visualforce.html

Let us know if this will help you

Thanks
Amit Chaudhary