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
Wilko Wielinga 4Wilko Wielinga 4 

Help needed with Flow embedded in Visualforce page

L.S.,

I'm quite new to this, so could be that I'm missing something.

I've tried to embed a Flow in a Visualforce page and include that page in a Chatter Quick action. This works fine. However, I also want the page to refresh automatically after the Flow is finished. I've let the Visualforce page set the retURL to another page that refreshes the browser. This refresh Visualforce page redirects the user to the Home page.

How can I refresh the page and direct the user to same (updated) record? For clarity, please find the explanation of the setup below.

Thanks in advance for your help.

I've embedded the Flow in a Visualforce page which is launched via the Chatter Quick Action.
<apex:page standardController="Lead" Showchat="False">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:600px" >
<flow:interview name="Qualification_Call" finishLocation="/{!$CurrentPage.parameters.id}">
    <apex:param name="varLeadID" value="{!Lead.Id}"/>
    <apex:param name="varUserID" value="{!$User.Id}"/>
</flow:interview>
</apex:OutputPanel>
</apex:page>
This refreshes the Lead in the Visualforce page rather than the full window. I've tried redirecting the page to a separate Visualforce page that should do the refresh, but as said above this redirects to the Homepage.
<apex:page standardController="Lead">
 <script>
    window.top.location='/{!lead.id}';
 </script>
</apex:page>


 
logontokartiklogontokartik
This is a security restriction that platform has, when you are trying to refresh the detail page from an inline visualforce page. I am not sure if JS hacks would work, but you can try something like
window.top.location.reload();

But again as I said, since detail pages are hosted in one domain and Visualforce pages in a different one, the workarounds might not work. You might want to see an old post from Bob Buzzard.

http://bobbuzzard.blogspot.com/2011/05/refreshing-record-detail-from-embedded.html
 
Wilko Wielinga 4Wilko Wielinga 4
Thanks for the answer. I read Bob Buzzards's blog post, but I'm still a bit confused on how to apply his solution to my situation. I don't have a Save button as all the DML-actions are performed in the Flow.

Can I use the following piece of code to refresh the page after the Flow is finished?

Custom controller
public PageReference save()
 {
  Account acc=(Account) stdCtrl.getRecord();
  acc.BillingCountry=chosenCountry;
  refreshPage=true;
  stdCtrl.save();
VF Page
<apex:outputPanel rendered="{!refreshPage}">
   <script>
      window.top.location='/{!Account.id}';
   </script>
</apex:outputPanel>