2

We've had a custom VF console for a while, with a custom search tied to inbound phone # and Case creation / update within an OutputPanel. A CommandButton on the page refreshes the panel and loads a Case in edit mode once the recordtype is selected by updating the workFrameURL with the new recordtype.

At least it used to.

Subsequent to Spring '14 release (related?), button click no longer refreshes correctly; panel remains blank instead of loading the new Case.

Button action:

public void updateCaseRecordType(){
    this.displayCaseIFrame = true;
        if(this.selectedRecordType != null){
            this.workFrameURL = this.workFrameUrlRoot + '&RecordType=' + this.selectedRecordType + '&ent=Case';
        } else {
            this.workFrameURL = this.workFrameUrlRoot;
        }
}

ActionRegion:

    <apex:define name="workarea" >
        <apex:actionRegion id="workArea" >
            <apex:outputPanel id="recordTypeSelector">
                <span style="font-weight:bold;font-size:1.1em;">Record Type: &nbsp;&nbsp;</span>
                <apex:selectList value="{!selectedRecordType}" multiselect="false" size="1">
                    <apex:selectOption itemValue="" itemLabel="Select a Record Type:" />
                    <apex:selectOptions value="{!caseRecordTypes}" />
                </apex:selectList>
                &nbsp;&nbsp;
                <apex:commandButton value="Update" action="{!updateCaseRecordType}" 
                                    rerender="{$Component.workArea.caseDisplayPanel}" />
                <br/>
            </apex:outputPanel>
            <apex:outputPanel id="caseDisplayPanel">
                <apex:outputPanel id="internalWrapper" rendered="{!displayCaseIframe}">
                    <apex:iframe width="950px" id="caseIFrame" src="{!workFrameURL}" height="4000px" ></apex:iframe>
                    <apex:outputPanel id="tempPanel" rendered="{!NOT(displayCaseIframe)}" >
                        <br/> This section is displayed until a record type is selected for the case. <br/>
                    </apex:outputPanel>
                </apex:outputPanel>
            </apex:outputPanel>
        </apex:actionRegion>
    </apex:define>

Most people are using Chrome.

Thoughts?

1

When I have rerender issues, I look for these possible causes

  1. The target component id of the rerender is a typo - in your example, you are rerendering caseDisplayPanel and there is a component with that id - so this isn't it
  2. The target component being rerendered started off invisible when the page was loaded so it can't be made visible. This is well documented in the classic Bob Buzzard post. This does not appear to be your issue as the target component is an outputPanel (div) and does exist at page load
  3. The target component being rerendered is not in the same hierarchy as the component requesting the rerender. In your example, id="caseDisplayPanel" is a sibling of id="recordtypeSelector", the latter being the component that is the parent of the commandButton. To resolve this, change the commandButton rerender to:

    rerender="{!$Component.idOftheForm.otherId1.otherId2. ... caseDisplayPanel}"

where otherId1.otherId2.... represent whatever other components are between the form and caseDisplayPanel in the hierarchy. This is covered in the VF doc under the section titled 'Best Practices for Accessing Component Ids'

  • That makes sense, and I added some additional ids where they seemed to be lacking so that I had some parent components to reference; in particular the actionRegion containing the two outputPanels as "workArea". I then changed the commandButton rerender as follows: rerender="{$Component.workArea.caseDisplayPanel}" I don't see any changes to the page behavior, though I am noticing in debug the function call outputs: VF_APEX_CALL|j_id78|{!updateCaseRecordType}|PageReference: none – Duncan Stewart May 2 '14 at 19:07
  • I'm wondering whether the empty PageReference is where the problem is ultimately stemming from? The updated workFrameURL appears to have all the correct parameters. – Duncan Stewart May 2 '14 at 19:12
  • It should be {!$Component ... not {Component. $Component is a global variable and hence must be identified to VF as such – cropredy May 2 '14 at 23:19
  • Thanks crop1645; I fixed that reference, and the page as a whole is refreshing, and now it appears that the action method of the button(s) on the page aren't being called; I added System.debug() statements inside the updateCaseRecordType() method and I don't see them in the system log. – Duncan Stewart May 4 '14 at 18:25
  • I added a button to see whether any action could be called: <apex:commandButton value="Create Case" action="{!foo}" rerender="{!$Component.workArea.caseDisplayPanel}" /> Controller method: public void foo() { System.debug('** foo was pressed here **'); } As far as I can tell, the page refreshes completely rather than calling the method and rerendering just the section I referenced. – Duncan Stewart May 4 '14 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.