You need to sign in to do that
Don't have an account?
Possible Bug on List View VF Page
I have created a VF page that uses a List View to retrieve records then a radio button to mass update the selected records. I received the following error message after selecting a View and clicking on the "Set Priority" button:
((toLabel(Status) LIKE '%AcOp%')) ORDER BY toLabel(Type) ASC LIMIT 10000 ^ ERROR at Row:1:Column:130 unexpected token: toLabel
Here is the controller:
public class CasesMassUpdatePriorityExt { public List<Case> cases; public List<Case> casesToUpdate; public String priority; private ApexPages.StandardSetController ssc; public CasesMassUpdatePriorityExt(ApexPages.StandardSetController controller) { this.ssc = controller; this.cases = (list<Case>)controller.getSelected(); } public String getPriority() { return priority; } public void setPriority(String priority) { this.priority = priority; }
public List<SelectOption> getPriorityItems() { List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult f = Case.Priority.getDescribe(); List<Schema.PicklistEntry> ple = f.getPicklistValues(); for (Schema.PicklistEntry pl : ple) { String plstr = pl.getValue(); options.add(new SelectOption(plstr,plstr)); system.debug('****plstr=' + plstr); } system.debug('****getPriorityItems=' + options); return options; }
public List<Case> getCases(){ return cases; } public PageReference save() { if (cases.size() > 0) { casesToUpdate = new List<Case>(); for (Case c : cases) { Case selCase = new Case ( id = c.Id); selCase.priority = priority; system.debug('*****Save:selcase.priority=' + selCase.priority + ' Priority=' + priority); casesToUpdate.add(selCase); } update casesToUpdate;
} PageReference myPage = new PageReference('/500/o'); myPage.setRedirect(true); return myPage; }
}
Here is the page:
<apex:page standardController="Case" extensions="CasesMassUpdatePriorityExt" recordSetvar="cases" Tabstyle="Case"> <apex:form > <apex:pageblock > <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:selectRadio value="{!priority}"> <apex:selectOptions value="{!priorityItems}"/> </apex:selectRadio> <apex:pageblockTable value="{!cases}" var="s" > <apex:column value="{!s.Subject}"/> <apex:column value="{!s.Account.Name}"/> <apex:column value="{!s.Contact.Name}"/> <apex:column value="{!s.CaseNumber}"/> <apex:column value="{!s.Priority}"/> </apex:pageblockTable> </apex:pageblock> </apex:form> </apex:page>
I have just had this exact problem.
Through trial and error I have found it is caused by the first column in a particular list view being of type picklist. I went through and altered list views that had a picklist in the first column and now the VF page works perfectly.
Hope that helps anyone who has come across this issue.