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
Ron McCrereyRon McCrerey 

refresh page from embedded visualforce in lightning

Working in Lightning.
I have a an embedded visualforce page.
I need to do page refresh on the container page.
Can anyone give an example of how to do this?
NagendraNagendra (Salesforce Developers) 
Hi Ron,

UseCase: VF page that sits on the Related tab of a Lightning record page basically displaying rollup fields about the related records. Right now, the refresh button reloads the visualforce page, but it does not update the fields displayed on the page. Is there any way I can have the fields update on the visualforce page without reloading the entire lightning page?

Please find the sample code below for the same and tweak it as per your requirement.
<apex:form id="theForm">
                <apex:pageBlock >
                <div class="slds-grid slds-wrap slds-grid--pull-padded">
                <div class="slds-col slds-size--1-of-3 slds-small-size--1-of-2 slds-medium-size--1-of-4">
                <apex:pageBlockSection columns="2">
                    <apex:outputField value="{!Opportunity.Total_Amount_Disbursed_Scheduled__c}" label="Total Disbursements"/>
                    <apex:outputField value="{!Opportunity.VCC_Percentage__c}" label="VCC Percentage"/>
                    <apex:outputField value="{!Opportunity.Number_of_Disbursements__c}" label="Number of Disbursements Made"/>
                    <apex:outputField value="{!Opportunity.VCC_Bank_Percentage__c}" label="VCC Bank Percentage"/>
                    <apex:outputField value="{!Opportunity.Balance_Outstanding__c}" label="Total Balance Outstanding"/>
                    <apex:outputField value="{!Opportunity.Other_Percentage__c}" label="Other Percentage"/>
                    <apex:outputField value="{!Opportunity.Loan_Limit_Code__c}" label="Loan Limit Code"/>
                    <apex:outputField value="{!Opportunity.Transmit_via__c}" label="Transmit Via"/>
                </apex:pageBlockSection>
                    </div>
                    </div>
                    <apex:pageBlockSection>
                    <apex:commandButton value="Refresh" action="{!Opportunity.reset}" rerender="theForm"/>
                    </apex:pageBlockSection>
                </apex:pageBlock>
            </apex:form>
Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra