I have created a lightning app page with type 'Record Page' and overridden default Opportunities page. I have added a new tab to its content and added a visualforce page as its component. Please see the image below.

enter image description here

The visualforce page contains codes to display documents and download link based on the current stageName of the opportunity. The code is as below.

<apex:page controller="stageDocus">
    <apex:panelGrid columns="5" id="theGrid" width="80%" style="margin:30px auto; text-align:center;">
        <apex:repeat var="sld" value="{!docs}">
            <div style="float:left; width:20%;">
            <apex:panelGroup id="theGroup1">
                <apex:image width="100%" id="theImage1" value="http://icons.iconarchive.com/icons/alecive/flatwoken/512/Apps-Google-Drive-Slides-icon.png"/>
                <apex:outputLink value="/servlet/servlet.FileDownload?file={!sld.Id}" target="_blank" id="theLink1">{!sld.Folder.Name}/{!sld.Name}</apex:outputLink>

The page is working fine when loaded. But if we change the stage, the content is not refreshing. We have to reload the page to see the updated content based on the new stage.

The apex class code I used is a below

public  class stageDocus
    public String currentRecordId {get;set;}
    public Opportunity Oppo{get;set;}    
    public stageDocus() {
        currentRecordId  =  ApexPages.currentPage().getParameters().get('Id'); 
        Oppo = [SELECT Id, Name, StageName, Amount FROM Opportunity WHERE Id = :currentRecordId];
    public List<Document> getdocs()
        List<Document> doc = [SELECT Id, Name, FolderId, Folder.Name FROM Document WHERE Folder.Name like :Oppo.StageName];
        return doc;

How can I refresh the visualforce page used as lightning page component whenever the Opportunity StageName is updated. Please help me.

  • I believe the solution in the duplicate can be used to refresh the component even if the component displays a VF page. I I am mistaken I will unmark it as dupe
    – Eric
    Commented Mar 16, 2017 at 13:18
  • I saw that question and tried it before posting this question. When I posted that code in my visual force it outputted error "Error: Unknown component aura:dependency". May I know how I can use that inside visual force page code?
    – AeJey
    Commented Mar 17, 2017 at 7:40
  • maybe a question about that then?
    – Eric
    Commented Mar 17, 2017 at 11:15
  • Ok. I have created it as a lightning component instead to make it work and got another error. I have added a question for that. salesforce.stackexchange.com/questions/164847/…
    – AeJey
    Commented Mar 17, 2017 at 11:20


Browse other questions tagged .