+ Start a Discussion
AlonAlon 

bug in getSelecred of StandardSetController

I have a view of contacts which is filtered according to a picklest value, called "existing equipment". On the list view there is custom button, and this is a snippet of the constructor of the controller of the button's page:

 

public page1(ApexPages.StandardSetController stdController) {

      list<Contact> cons;
      cons = (list<Contact>)stdController.getSelected();

      //more analysis..

}

 

This worked fine until the view's filter was changed to existingEquipment__c=MC\123. The view still works, showing the correct contacts, but clicking on the custom button generates the following error:

 

system.security.NoAccessException: Object type not accessible. Please check permissions and make sure the object is not in development mode: (((ExistingEquipment__c = 'MC\123'))) ORDER BY Name ASC ^ ERROR at Row:1:Column:60 Invalid string literal 'MC\123'. Illegal character sequence '\1' in string literal. 

 

Checking the debug log, I see that the error comes from getSelected(). It looks like a bug in getSelecred() - it should work also when the list is filtered according to a picklist value that contains '\'!

 

Can someone offer a workaround for that?

 

 

 

AravindBabu512AravindBabu512

I could see that the "existingEquipment__c" is a picklist, so please use the ISPICKVAL function for your filter.

 

Thanks,

Aravind

AlonAlon

Hi Aravind,

The filtering is done in the edit page of the listview, not in a formula, so I cannot use ISPICKVAL, just choose fileds and use the "equal" parameter. As I wrote, it works for the view, but if you want to transfer values from this view to a visualforce page using a custom button, getSelected() fails.