function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KVaishnaKVaishna 

Refresh related list based on inline visualforce page

Hi,

 

How can I refresh my particular related list based on certain action I perform on inline visualforce page?

 

I have inline VF page on Account Object and based on click of link on it, I insert record in one object. I only want to refresh

 

that inline VF page and related list of the object in which I inserted the record. I can refresh inline VF but how to refresh

 

specific related list? I am trying with rerender option but not getting Id of the specific related list on the page.

 

Thanks

- Kunjan

bob_buzzardbob_buzzard

You won't be able to refresh any part of the standard page - your choices are to refresh just your inline visualforce page or the entire browser page.  This is because your VF comes froma different server to the main page, and thus the browser would block any attempt by you to change part of it as cross site scripting.

 

SatgurSatgur

Hi Bob,

 

When you said refresh the entire browser page, did you mean manually or control the browser page refresh from within Inline VF page?

 

If you can let us know how we can refresh the whole browser page from inline VF directly.

 


bob_buzzard wrote:

You won't be able to refresh any part of the standard page - your choices are to refresh just your inline visualforce page or the entire browser page.  This is because your VF comes froma different server to the main page, and thus the browser would block any attempt by you to change part of it as cross site scripting.

 


 

Thanks

Satgur

JeeedeeeJeeedeee

Hi Satgur,

I wonder if you have solved this already? I tried code below from another page, but that's not working either :(

 

<apex:commandButton action="{!submit}" value="Submit" oncomplete="top.location.reload(true);"/>

A lot of topics around this area, but can't find a solution to do a complete page refresh. (and using the pagereference I get a complete Salesforce screen in my inline area)

Thanks, JD

bob_buzzardbob_buzzard

I suspect that syntax isn't working as the command button is causing a full page refresh rather than an ajax update.

 

Try altering to the following:

 

 

<apex:commandButton action="{!submit}" value="Submit" rerender="some_id" oncomplete="top.location.reload(true);"/>

 where some_id is the id of a component elsewhere in your VF page.  This should allow the oncomplete to fire.

 

 

 

JeeedeeeJeeedeee

Hi Bob,

Thanks for the suggestion, but it also didn't worked for me in firefox. The reason that I would like to refresh the complete page was because I was cancelling the input. I found out that with the following Apex code all fields on account were reset to their original values, and the visual force page rendered in display mode again. A little bit offtopic, but maybe usable for others.

 

public PageReference cancelEdit() {
	stdController.cancel(); 
	// create this new pagereference, to disgard all modified values
    	PageReference freshPage = Page.MyCustomAccounPage;
     	freshPage.getParameters().put('id', account.id);
      	freshPage.setRedirect(true);
	return freshPage;
}

 

 

 

SatgurSatgur

This was solved.

 

We used CommandLink with below mentioned syntax to achieve the whole browser page refresh from inside an inline VF -

 

 

 <apex:commandLink value="Add" StyleClass="btn" action="{!addLineItem}" id="saveLineItem" status="status_table" target="_top" />

 

 

As you can changing it to a CommandLink (instead of button) and using target-"_top", did the trick for us.

 

You can also try above.

 

Note - yes we had to use a CSS Style class to give commandLink, look and feel of a Button.