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
SatgurSatgur 

Refreshing Standard Page (whole browser page) from an action in an Inline VF page??

Hi,

 

Not sure if Salesforce would allow this (knowing all cross-domain javascript restrictions coming into play et.) but is it possible to somehow enforce a whole browser page refresh from an inline Visualforce page (i.e. an embedded VF within Standard page)?

 

This is needed since the inline VF page captures data for one of the CHILD objects (Opportunity standard page having sub-section for OpportunityLineItem data).

 

Hence whenever we add a new Opportunity Line item using this inline vF page, there are some rollup calculations happening on parent i.e. Opportunity and since those roll up fields are present on Opportunity Standard page, only way for us to show latest information on UI is to somehow cause whole page to refresh so that Opportunity shows updated roll up fields, as well as Inline VF shows new line item added. 

 

I am bit skeptical about this as we have seen issues in past where VF are rendered from a separate domain and standard pages from different, hence cross-domain JS issues may arise here if we try to refresh PARENT using  javascript within Inline VF.

 

I saw a similar post but not sure how we can do whole brower refresh -

http://community.salesforce.com/t5/Visualforce-Development/Refresh-related-list-based-on-inline-visualforce-page/m-p/186161/highlight/false#M24759

 

Any insight, help is appreciated.

 

Thanks

Satgur

KunlunKunlun

I'm still looking for the method of refresh standard page by inner visual force page.

Do you get the answer?

Thanks

Kunlun

SatgurSatgur

Here you go.

 

This has been 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.

dmchengdmcheng

Thanks for posting this.  However, I tried it and it doesn't work for me.  When I click the link, the inline VF page takes over the whole browser page.  I tried target="_parent" and that didn't work either.

 

David

SteveBowerSteveBower

What if, instead of using a standard page with an inline VF page, you:

 

1. Still configured your VF page as an inline page.

 

2. Created a new page which would override the standard page, but would have nothing but the Apex:Detail tag.  (which would still your page as inline)

 

3. Then, at least you'd be away from the cross-domain restrictions because both the inline page, and the top level page would both be VF pages.

 

4. Then perhaps you can use Javascript to request a refresh.

 

Best, Steve.

SatgurSatgur

David,

 

How did you code the Action function inside Controller class? Does that method return anything?

 

Believe you are returning a PageReference from there. Please confirm, as that may cause the issue if you return a page reference explicitly.

 

I can then with our own implementation and advise why your code doesn;t work.

 

Thanks

Satgur

Krishna RadhakrishnanKrishna Radhakrishnan
This works. For both regular page and console.
...
...
...       
 <script src="/support/console/42.0/integration.js" type="text/javascript"></script>
        <script  type="text/javascript">                                                
            function reloadPage() {   
                if(sforce.console.isInConsole()){
                    sforce.console.getEnclosingTabId(refreshSubtab);
                }else{                            
                    window.top.location.href = '<Id key of the page. Eg: CaseId if it is a Case page>';
                }                        
            }
            
            var refreshSubtab = function refreshSubtab(result) {            
                var subtabId = result.id;
                sforce.console.refreshSubtabById(subtabId, true, null);
            };
        </script>  
...
...
...
...
...
...

<apex:commandButton action="{!updateCaseProduct}" value="Update" id="updBtn" oncomplete="reloadPage();"/>