Activity Forums Salesforce® Discussions Refresh parent after child action on inline Visualforce Page

  • Abhinav

    March 29, 2016 at 11:26 am

    I have my inline VF page on Opportunity detail. On inline VF page there is a custom button such that on click of that button a small window gets open up on the opportunity detail page. After performing some action I want to close the window and as well as want to refresh that particular Opportunity record. I am able to close the window but how should I refresh the Opportunity?

  • Shubham

    March 29, 2016 at 12:43 pm

    Hello Abhinav,

    You can achieve this by adding this javascript code snippet into your parent VF page.

    var popupwindow;
    var timer;
    //call this function onclick of custom button
    function popup(){
    popupwindow = open('/apex/ChlidPageName','Popup','height=400,width=400,left=100,top=100,scrollbars=yes,toolbar=no,status=no');
    timer = setInterval(checkWindow, 500);
    function checkWindow(){
    alert("Child window closed");

    I hope this might help you.

  • Ravi

    March 29, 2016 at 1:24 pm

    Hi Abhinav,
    You can refresh your parent page or a section of parent page using window.opener functionality of java-script.

    //function to open a child page(popup)
    function popupwindow(){'child page url');
    //function to called from child page(popup)
    function refreshParent(){
    //refresh your page or section of page

    Child Page:
    function closeAndRefresh() {

    window.opener.refreshParent();//call the parent function and that does thetrick;


    • This reply was modified 5 years, 8 months ago by  Ravi.
  • Parul

    September 19, 2018 at 9:11 pm

    Hi Abhinav,

    Apex Class:-

    public class Opp_Ext {
    private ApexPages.StandardController stdController;
    public String redirectUrl {public get; private set;}
    public Boolean shouldRedirect {public get; private set;}

    public Opp_Ext(ApexPages.StandardController stdController) {
    this.stdController = stdController;
    shouldRedirect = false;

    public PageReference doStuffAndRedirect() {
    shouldRedirect = true;
    redirectUrl = stdController.view().getUrl();
    return null;

    Visualforce Page:-

    <apex:page standardController="Opportunity" extensions="Opp_Ext" >
    <apex:form >
    <apex:commandButton value="Do Stuff" action="{!doStuffAndRedirect}" rerender="redirectPanel" />
    <apex:outputPanel id="redirectPanel" >
    <apex:outputText rendered="{!shouldRedirect}">
    <script type="text/javascript"> = '{!redirectUrl}';

    Hope this helps.

  • shariq

    September 19, 2018 at 10:35 pm


    You can achieve this by using Window opener functionalty of Java script.

    Example -

    function popupSlide(){‘URL’);

    Hope this helps.

Viewing 1 - 5 of 5 posts

Log In to reply.

Popular Salesforce Blogs