You need to sign in to do that
Don't have an account?
MATTYBME
Searching Solutions search method
Having trouble determining the right controller method for a search page for searching Solutions. I want to do a similar search function to the Find Solutions box that can be displayed in a homepage.
I get a "Error: Compile Error: Incompatible types since an instance of LIST:SObject is never an instance of LIST:Solution at line 14 column 11" on the Apex Class.
Not sure how to proceed.
Message Edited by MATTYBME on 01-12-2009 06:05 AM
Code:
<apex:page controller="Solutions"> <apex:form> <apex:pageBlock mode="edit" id="block"> <apex:pageBlockSection> <apex:pageBlockSectionItem> <apex:outputLabel for="searchSolutionText">Search Solutions</apex:outputLabel> <apex:panelGroup> <apex:inputText id="searchSolutionText" value="{!searchSolutionText}"/> <apex:commandButton value="Go!" action="{!doSearch}" rerender="block" status="status"/> </apex:panelGroup> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:actionStatus id="status" startText="requesting..."/> <apex:pageBlockSection title="Results" id="results" columns="1"> <apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}"> 66 Controller Methods <apex:column value="{!l.solutionname}"/> <apex:column value="{!l.solutionnote}"/> <apex:column value="{!l.createddate}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Code:
public class Solution { String searchSolutionText; List<Solution> results; public String getSearchSolutionText() { return searchSolutionText; } public void setSearchSolutionText(String s) { searchSolutionText = s; } public List<Solution> getResults() { return results; } public PageReference doSearch() { results = (List<Solution>)[FIND :searchSolutionText RETURNING Solution(SolutionName, SolutionNote, CreatedDate)][0]; return null; } }
I get a "Error: Compile Error: Incompatible types since an instance of LIST:SObject is never an instance of LIST:Solution at line 14 column 11" on the Apex Class.
Not sure how to proceed.
Message Edited by MATTYBME on 01-12-2009 06:05 AM
with:
Correct?
Is there any way to limit the search result to solutions that are Visible To the Public rather than returning all solutions.
Thanks