Skip to main content Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
I have been able to get similar ones to work (based on prior challenges) but I am struggling here.  Probably a newbie mistake somewhere.  Any help would be appreciated!  Thanks, Aron

-> Page (Gives Error: Unknown property 'String.Id error)

<apex:page controller="NewCaseListController">

    <apex:form >

        <apex:pageBlock title="Case List" id="Case_list">

            <!-- Case_list -->

         <apex:repeat value="{!Case}" var="case">

            <apex:outputLink value="{!Case.Id}">{!Case.Id}</apex:outputLink>

            <apex:outputLink value="{!case.CaseNumber}">{!case.CaseNumber}</apex:outputLink>

        </apex:repeat>      

        </apex:pageBlock>

    </apex:form>

</apex:page>

-> Class

ublic class NewCaseListController {

    public String getCase() {

        return null;

    }

    public String getCases() {

        return null;

    }

private String sortOrder = 'CaseNumber';

public List<Case> getNewCases() {

    List<Case> results = Database.query(

        'SELECT Id, CaseNumber ' +

        'FROM Case ' +

        'WHERE Status = New ' +

        'ORDER BY ' + sortOrder + ' ASC ' +

    );

    return results;

    }

}
답변 23개
  1. 2015년 2월 27일 오후 6:42
    I'm not quite sure why you have 3 methods (1 getCase, and 2 getCases).  Really you just need the one to return the Case object and all the detail of it.  Your other get methods aren't doing anything because they are returning null.

    I'm not an expert, but I made some modifications, it seems to complile for me, but I haven't tested it, because we don't use cases.

    Note, I removed your sort order because I wasn't sure what you wanted to sort by.  Ie it should be ORDER By Name ASC   etc

    Also, there shouldn't be a +  after ASC  because there's nothing else there.

     

    <apex:page controller="NewCaseListController">

    <apex:form >

    <apex:pageBlock title="Case List" id="Case_list">

    <!-- Case_list -->

    <apex:repeat value="{!Case}" var="cs">

    <apex:outputLink value="{!cs.Id}">{!cs.Id}</apex:outputLink>

    <apex:outputLink value="{!cs.CaseNumber}">{!cs.CaseNumber}</apex:outputLink>

    </apex:repeat>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

     

    Public class NewCaseListController {

    List<Case> results = new List<Case>();

    private String sortOrder = 'CaseNumber';

    public List<Case> getCase() {

    results = [SELECT Id, CaseNumber FROM Case WHERE Status = 'New'];

    return results;

    }

    }

    Hope this helps.

     
로딩 중
0/9000