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
InternalServerErrorInternalServerError 

rerender doesn't get the updated value of a field.

The code below rerenders the time on the "randompanel" but it doesn't shows the new value of the case status when clicking on the Reopen case button. The random panel and the NOW function were added just to test. The action {!ReOpenCase} sets the status of the case to "reopened" and this is happening but the rerender doesn't display that value. I opened a case with salesforce about this and is escalated to tier 3.....any ideas?

 

 

<apex:outputPanel id="randompanel" >
<apex:outputtext value="{!NOW()}"/>
<apex:outputtext value="{!case.status}"></apex:outputtext>

</apex:outputPanel>
<apex:form >

<apex:commandButton action="{!ReOpenCase}" value="Reopen Case" id="ReopenCaseButton" reRender="randompanel" rendered="{!IF(case.Status == 'Resolved' || case.Status == 'Closed',true,false)}"/>


</apex:form>

 

Thanks in advance for any help on this. I have spent a lot of time trying to make it work :(

cduncombe44cduncombe44

For some reason in the past when I have run into this, nested output panels have solved the issue.  Something like this

 

<apex:outputPanel id="OuterPanel" >

<apex:outputPanel id="randompanel" >
<apex:outputtext value="{!NOW()}"/>
<apex:outputtext value="{!case.status}"></apex:outputtext>
</apex:outputPanel>
</apex:outputPanel>

 

Then refresh the outer panel.  I dont know why, but this has solved some of my rerendering issues in the past

S91084S91084

Hi,

 

The following code works for me. You can modify your existing code based on the below one.

 

<apex:page standardController="Case" extensions="caseExtension">
    <apex:outputPanel id="randompanel" layout="block">
    <apex:outputtext value="{!NOW()}"/><br/>
    <apex:outputtext value="{!c.status}"/>
   </apex:outputPanel>
    <apex:outputPanel id="ReopenCaseButton" layout="block">
    <apex:form>
        <apex:commandLink action="{!ReOpenCase}" value="Reopen Case"   reRender="randompanel,ReopenCaseButton"  styleClass="btn" style="text-decoration:none;"  rendered="{!IF(c.Status == 'Resolved' || c.Status == 'Closed',true,false)}"/>
   </apex:form>
    </apex:outputPanel>
</apex:page>

 Below is the controller

 

public with sharing class caseExtension {
      
    public case c {
        get{
            if(c==null)
                c = [Select Id,Status from case where Id =:ApexPages.currentPage().getParameters().get('id')];
            return c;
        }
        set;
    }
    public caseExtension(ApexPages.StandardController controller) {

    }
    public PageReference ReOpenCase(){
        c.Status = 'New';
        update c;
        return null;
    }
}

 

Vishal GuptaVishal Gupta
hey, its fine with ur solution but can u plz tell wt is the point to rerender the following panel??

<apex:outputPanel id="ReopenCaseButton" layout="block">
S91084S91084

Hi, When you rerender the outputpanel "ReopenCaseButton", the rendered condition you have mention for your button get reevaluated. So based on the status you set it get reevaluated and the button displays accordingly.