+ Start a Discussion
TLeahyTLeahy 

refresh detail page on inline VF page 'save'

I have a VF page inline on a custom object. It has various custom fields, and upon saving it reloads just the section that the VF page is in, not the entire page. Additionally, it reloads the entire detail page [side bar header and all], not just the VF page. Is there a way to either have the entire window refresh, or have the inline area refresh with just the VF page, and nothing else.

Dev@Force.ax647Dev@Force.ax647

You can use window.location=window.location  in javascript which will refresh inline page or you can use pagereference of same page after save in apex.

 

For parent refresh use window.parent.location=window.parent.location in javascript.

 

 

TLeahyTLeahy

Sorry if this is a stupid question, I'm not terribly proficient in javascript and have been working with salesforce for only about 3 months.

 

Where exactly would I be putting the javascript, in the VF page? Or the controlling class?

And how might I format/write it out?

 

I wrote it into the VF page's code, as:

 

<script type="text/javascript">
      window.parent.location=window.parent.location;
      
</script>

 

And it kind of works..upon hitting 'save' it first reloads the inline area, but then reloads the entire page almost immediately, but only loads the VF page and not the rest od the object on which the VF page is applied. It also seems to get stuck into a loop where it reloads over and over.

 

 

TLeahyTLeahy

Actually, that might have something to do with me having Development Mode enabled, and upon disabling it the window just continually refreshed and never loaded anything.

 

When I changed the code to have empty brackets at the end

 

<script type="text/javascript">
      window.parent.location = window.parent.location;
      
</script>

 it is no different than before - it loads the entire page inside the VF area

Dev@Force.ax647Dev@Force.ax647

create a boolean property isSaved in apex and set it default value to false. and in save method set its value to true and change javascript as below

<script type="text/javascript">
if("{!isSaved}"=="true")
{
 window.parent.location = window.parent.location; } </script>