3

I am currently trying to expand upon the Web-To-Case functionality by exposing certain updates to our users.

When trying to do this I would need a way for them to enter their case number, then pull up the field.

I've currently got the search field, and subsequent query running properly, but the case feed doesn't appear in the page, even after re-rendering it.

Visualforce code:

<apex:page standardController="Case" extensions="CaseReviewExtension" sidebar="false" showHeader="false">
    <apex:form >
        <span>Ticket Number:</span>
        <apex:inputText value="{!caseNumber}"/>
        <apex:commandButton value="Search" action="{!getCaseFeed}" reRender="feed"/>
        <apex:outputField value="{!selectedCase.Id}" id="feed"/>
    </apex:form>
    <chatter:feed entityId="{!selectedCase.Id}" id="feed" showPublisher="true" feedItemType="CaseCommentPost"/>

</apex:page>

Apex Code:

public class CaseReviewExtension {

    public final Case thisCase;

    public String caseNumber {get;set;}

    public Case selectedCase {get;set;}

    public CaseReviewExtension(ApexPages.StandardController stdController) {
        this.thisCase = (Case)stdController.getRecord();
        selectedCase = new Case();
    }

    public void getCaseFeed(){
        selectedCase = [SELECT Id FROM Case WHERE CaseNumber = :caseNumber];
    }
}

1 Answer 1

2

Use apexpages.currentpage() attribute and change your void method to a page reference method.

To understand why you need to use apexpages.currentpage() method see here: Difference between returning null and ApexPages.currentPage()

change the void method to :

public pagereference CaseFeed(){
    selectedCase = [SELECT Id FROM Case WHERE CaseNumber = :caseNumber];
    return apexpages.currentpage();
}

Page:

you have 2 tags with same id="feed" remove the outputfield

<apex:page standardController="Case" extensions="CaseReviewExtension" >
    <apex:form >
        <span>Ticket Number:</span>
        <apex:inputText value="{!caseNumber}"/>
        <apex:commandButton value="Search" action="{!CaseFeed}"/>
    </apex:form>
    <chatter:feed entityId="{!selectedCase.Id}" showPublisher="true" feedItemType="ChangeStatusPost"/>
</apex:page>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .