0

I developed a hybrid visualforce/lightning page with a custom save method using an extension to be used as a console sidebar. The page and save method work fine but I can't get the rerender to fire using my current format. I've isolated the issue but i'm not sure how to fix it. I'm pretty sure the varibale is coming back null so the apex:outputPanel can't see the change in picklist value.

I've isolated the issue at the inputField here:

<apex:actionRegion > 
   <apex:inputField id="pri" value="{!c.Priority__c}" required="true">
      <apex:actionSupport event="onchange" rerender="casePB" />
   </apex:inputField>
</apex:actionRegion>

When I adjust the value {!c.priority__c} to {!case.priority__c} like below the rerender works but the save method does not for this field:

   <apex:actionRegion > 
      <apex:inputField id="pri" value="{!case.Priority__c}" required="true">
         <apex:actionSupport event="onchange" rerender="casePB" />
      </apex:inputField>
   </apex:actionRegion>

Here is the full Visualforce Page with the issue located between lines 325-329:

<apex:page standardController="case" extensions="caseInlineEditExt,caseStatusDetailsExt" sidebar="false" docType="html-5.0">


<!-- import the lightning design system style sheet -->
  <apex:slds />
  <!-- load latest jquery -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <!-- load support console js library -->
  <apex:includeScript value="/support/console/39.0/integration.js"/>

<div class="slds-scope">

    <!-- begin case issue -->
    <div class="problem-info slds-panel slds-grid slds-grid--vertical slds-nowrap">
        <div class="slds-panel__section">
            <h3 class="heading-link slds-text-heading--medium"><apex:outputField value="{!c.Problem_Statement_Question__c}"/></h3>
            <h3 class="log text-body--default"><span class="link"><apex:outputField value="{!c.contactid}"/></span> reported &nbsp;<apex:outputField value="{!c.createddate}"/> via &nbsp;<apex:outputField value="{!c.origin}"/></h3>
            <button class="slds-button" href="#" id="show">Show Problem Details</button>
            <button class="slds-button" href="#" id="hide">Hide Problem Details</button>
            <div class="problem-detail">  
                <h3 class="text-body--default">{!c.Problem_Details__c}</h3>
            </div>
        </div>
    </div>
    <!-- end case issue -->
    <apex:form >
        <apex:pageBlock id="casePB">
        <apex:pageMessages />
            <!-- begin contact information -->
            <apex:pageBlockSection columns="1" title="Contact Information">
                <apex:pageBlockSectionItem >
                    <apex:outputPanel layout="none">
                        <div class="slds-grid"><!-- begin grid -->
                            <div class="left slds-col"><!-- begin left column -->
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Contact <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.contactid}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Phone <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:outputField value="{!c.contactphone}"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Mobile</span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:outputField value="{!c.contactmobile}"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Email <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:outputField value="{!c.contactemail}"/>
                                        </span>
                                    </div>
                                </div>
                            </div><!-- end left column -->
                            <div class="right slds-col"><!-- begin right column -->
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Account <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.accountid}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Requesting Company</span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Requesting_Company__c}"/>
                                        </span>
                                    </div>
                                </div>
                            </div><!-- end right column -->
                        </div><!-- end grid --> 
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <!-- begin problem information -->
            <apex:pageBlockSection columns="1" title="Problem Information">
                <apex:pageBlockSectionItem >
                    <apex:outputPanel layout="none">
                        <div class="slds-grid"><!-- begin grid -->
                            <div class="left slds-col"><!-- begin left column -->
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Severity <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:actionRegion > 
                                                <apex:inputField id="severity" value="{!c.Severity__c}" required="true">
                                                    <apex:actionSupport event="onchange" rerender="casePB" /> 
                                                </apex:inputField>
                                            </apex:actionRegion>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Priority <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:actionRegion > 
                                                <apex:inputField id="pri" value="{!c.Priority__c}" required="true">
                                                    <apex:actionSupport event="onchange" rerender="casePB" />
                                                </apex:inputField>
                                            </apex:actionRegion>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Problem Type <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.type}" required="true"/> 
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">AtScale Version <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.AtScale_Version__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                            </div><!-- end left column -->
                            <div class="right slds-col"><!-- begin right column -->
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Status <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.status}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">SubStatus <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.SubStatus__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Product Component <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Product_Component__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Product SubComponent <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Product_SubComponent__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                            </div><!-- end right column -->
                            </div><!-- end grid -->
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Problem Statement/Question</span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Problem_Statement_Question__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <apex:outputPanel id="hpOPP" rendered="{!IF(case.Priority__c = 'High - 4 hour response expected', true, false)}" layout="none">
                                    <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                        <span class="slds-form-element__label">High Priority Business Justification <span class="req">*</span></span>
                                        <div class="slds-form-element__control">
                                            <span class="slds-form-element__static">
                                                 <apex:inputField id="hpIPF" value="{!c.High_Priority_Business_Justification__c}"/>
                                            </span>
                                        </div>
                                    </div>
                                </apex:outputPanel>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Current Status <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Current_Status__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Next Steps <span class="req">*</span></span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Next_Steps__c}" required="true"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Jira Bug</span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static full-width">
                                            <apex:inputField value="{!c.Jira_Bug__c}"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Jira Feature Request</span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static full-width">
                                            <apex:inputField value="{!c.Jira_Feature_Request__c}"/>
                                        </span>
                                    </div>
                                </div>
                                <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                                    <span class="slds-form-element__label">Fix in Version</span>
                                    <div class="slds-form-element__control">
                                        <span class="slds-form-element__static">
                                            <apex:inputField value="{!c.Fix_in_Version__c}"/>
                                        </span>
                                    </div>
                                </div>  
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <!-- case information -->
            <apex:pageBlockSection columns="1" title="Case Information">
                <apex:pageBlockSectionItem >
                    <apex:outputPanel layout="none">
                        <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                            <span class="slds-form-element__label">Owner <span class="req">*</span></span>
                            <div class="slds-form-element__control">
                                <span class="slds-form-element__static lookup">
                                    <apex:inputField value="{!c.ownerid}" required="false"></apex:inputField> 
                                </span>
                            </div>
                        </div>
                        <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                            <span class="slds-form-element__label">Deployment Phase <span class="req">*</span></span>
                            <div class="slds-form-element__control">
                                <span class="slds-form-element__static">
                                    <apex:inputField value="{!c.Deployment_Phase__c}" required="true"/>
                                </span>
                            </div>
                        </div>
                        <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                            <span class="slds-form-element__label">Escalated</span>
                            <div class="slds-form-element__control">
                                <span class="slds-form-element__static">
                                    <apex:inputField value="{!c.Escalated__c}"/>
                                </span>
                            </div>
                        </div>
                        <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
                            <span class="slds-form-element__label">Opened</span>
                            <div class="slds-form-element__control">
                                <span class="slds-form-element__static">
                                    <apex:outputField value="{!c.createddate}"/>
                                </span>
                            </div>
                        </div>
                        <apex:commandButton action="{!save}" value="Update Case"/>  
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</div>
</apex:page>

Here is my extestion class with the save method and redirect back to the edit page:

public class caseInlineEditExt {

    public case c { get; set; }

        public caseInlineEditExt(ApexPages.StandardController stdCtrl) {

            case currentRecord = (case) stdCtrl.getRecord();  

            c = [SELECT Id, createddate, origin, casenumber, type, status, contactid, contactemail, contact.firstname, ownerid,
                contact.lastname, contactphone, contactmobile, accountid, requesting_company__c, problem_statement_question__c, 
                assisted_by__c, atscale_version__c, case_issue__c, current_status__c, date_time_resolved__c, deployment_phase__c,
                escalated__c, fix_in_version__c, high_priority_business_justification__c, jira_bug__c, jira_feature_request__c, next_steps__c,
                priority__c, problem_details__c, product_component__c, product_subcomponent__c, resolution__c, root_cause__c, severity__c, 
                substatus__c, priority FROM case WHERE Id = :currentRecord.id];    

        }

    public PageReference quickUpdate() {

            update c;

            return ApexPages.CurrentPage();

    } 

}
3
  • It won't work because case variable is not defined. And since you're using StandardController it won't throw any error because case is standard object as well. – Rohit Mourya Mar 15 '17 at 13:00
  • I think you're talking about the save() method not working because case variable is not defined in my extension? – jdallas Mar 15 '17 at 14:33
  • Yes. That can be one of the reason – Rohit Mourya Mar 15 '17 at 15:05
0

I decided to rewrite my save() method which also now does a redirect back to my visualforce page. Rerender and save methods now work perfectly.

Adding my update code for anyone curious...

Now relying on standard controller for my variables in visualforce page:

<apex:page standardController="Case" extensions="caseDetailSdbrSave" sidebar="false" docType="html-5.0">

<apex:actionRegion > 
   <apex:inputField id="pri" value="{!case.Priority__c}" required="true">
      <apex:actionSupport event="onchange" rerender="casePB" />
   </apex:inputField>
</apex:actionRegion> 


<apex:outputPanel id="hpOPP" rendered="{!IF(case.Priority__c = 'High - 4 hour response expected', true, false)}" layout="none">
    <div class="slds-form-element slds-hint-parent slds-has-divider--bottom">
        <span class="slds-form-element__label">High Priority Business Justification<span class="req">*</span></span>
        <div class="slds-form-element__control">
            <span class="slds-form-element__static">
                <apex:inputField id="hpIPF" value="{!case.High_Priority_Business_Justification__c}"/>
            </span>
        </div>
    </div>

My new extension with standard controller save method and redirect:

public class caseDetailSdbrSave{

          ApexPages.StandardController stdController;

              public caseDetailSdbrSave(ApexPages.StandardController c){

              stdController = c;
          }

          public PageReference save() {

             stdController.save();

             PageReference pg = Page.caseDetailSdbr;

             pg.getParameters().put('Id',stdController.getId());

             return pg;
         }


}

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.