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
Emily PhillipsEmily Phillips 

Refresh formula field on Visualforce page?

Hello! I'm displaying a number formula field on a Visualforce page using apex:outputField. The formula field calculates a "score" for our Contact records. The formula adds a point if certain fields are not null on a record. I've added the Visualforce page to a Lightning Page using the Visualforce standard component. 

Here's my issue: The number formula field doesn't refresh or recalculate when I update fields in the Details section on the Lightning page. How can I refresh the formula field without having to refresh the entire page everytime I make a change to a record? 

Any help is appreciated!
Andrew GAndrew G
Hi Emily

Investigate the reRender and Rendered attributes.
 
<apex:page controller="MyController1">
<apex:form>
<apex:pageBlock >
<apex:pageBlockSection  id="search">
<apex:commandLink action="{!commandLinkAction}" value="Advance Search"  reRender="thePanel" id="theCommandLink"/>
<apex:outputPanel id="thePanelWrapper">
<apex:outputPanel id="thePanel" rendered="{! rend}" layout="block">My div</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Regards
Andrew​​​​​​​
Dushyant SonwarDushyant Sonwar
Hey Emily ,

Please post your vf page code , it will help others to debug your issue.

Regards,
Dushyant
Emily PhillipsEmily Phillips
Hello Dushyant, my code is very simple. Please see below: 
<div>
 <apex:outputField id="contactScore" value="{!Contact.Contact_Score__c}"/>
</div>