Refresh parent page after close popup

Hi - so I have a pop-up that is used to update address fields on a record. When I save the changes and close the pop-up, I want to refresh the original parent record on the page. 

I’ve tried adding in a Query Model action on the button that activates the pop-up - assuming it would action after the pop-up closes, but it actions right after the pop-up opens.

If I had a separate Refresh button that re-queries, then that works fine after the pop-up has closed - but I really want to have the refresh when the pop-up saves and closes.


Well, there are several ways to do this. Just depends what you’re doing in the popup. Quick note, all the suggestions I’ve got assume that something is done to a model in the popup or a button is pushed. If the user does nothing in the popup and closes the popup by clicking on the X. Refreshing the model on the parent page can’t be done unless there is a way to do this in javascript. So, I’m assuming that you’re needing to refresh the parent page because something done in the popup affects the parent page model(s) . Two options. 1. Create an On Model Save action for the model in the popup. Set one action to query all the models you’d like. This ensures that no matter what, if changes are made then the related models will be updated. 2. Put the above mentioned action in a button on the popup. This is less desired as this requires a component where you can add custom buttons or row actions, which you may not have currently.

What we’ve been doing lately is adding custom “save and close” buttons to our popups.  These do a chain of things. 

1. Save the “New record model”
2. Save the “underneath model” - in case changes have been made  in the table that have not yet been saved. 
 – In both steps if there are validation errors you stop the chain and return the user to either the popup or the underlying page. 
3. Query both models - to do the refresh you are asking about
4. Close the popup. 

We usually wrap the whole think in a “block ui and show message” action so the user is informed that the page is working. 

The only downside to this strategy is that you need a page title component in your popup to host your custom buttons,  and the “save” button is not aware of changes - so it is not greyed out when the popup first loads. 

Hopefully that helps. 

Hey Rob, could you share a bit more about how you set up this custom “save and close” button. How do you achieve this set of steps? 

I am trying to solve for the same use case. 


Hey Rob,

I tried this out, but I think my use case is different.  Our popup uses different models than the parent page (the popup inserts records to another object) so the parent page model is not available to query model.

I can’t re-direct to URL since my parent table is actually a sub-component of a VF page.

Any other way to get a refresh/re-query sent to the parent page?  javasnippet?

Next day update:  Nevermind.  It works now.  I’m not really sure why, but it works.

thanks, jhb

Hi All, 

My pop-up contains a Page Include.  I use this combination - pop-up + page include - on many different pages.  In all cases, I need to refresh the parent page so that changes made within my pop-up/page include are shown when the pop-up is closed.  Any ideas?

There’s only one to do this that I know of. It involves using a query action and editing the options of the query action via XML to query the named Model on the parent page as it is not in the list of models to choose from on the page include page.

This works perfectly well.  I was suprized… 

That does indeed work perfectly well!  Very cool.

It is really slow, however - a full 6 seconds to query and close the pop-up.  I know I have models across pages that use the same name.  I’m going to try to rename and see if that helps with speed…thoughts on that?

Ooh - better solution to this.  Put the Button Actions in the following order: 

- Save Model Changes
- Close Topmost Popup
- Query Models 

(No need to query BEFORE the popup is closed.  This way, the popup is closed quickly and the query still happens - no waiting and wondering for the user.)  

Perhaps this was obvious to everyone else.  :-)

The above solutions seem not being able to handle that the popup is in pageInclude. Cause we could find out the parent models inside the page-included popup.