I've been trying to create a wrapper class for either SelectOptions and/or input checkboxes combined with pseudo Id's for both the checkbox and a Description text area input field to send to a Visualforce page (I need to toggle visibility on the text area). Everything I've tried has resulted in an Entity is not API accessible
error message when I've attempted to save the class. I do have an account Id I can pass in the class (in actuality, only one) along with the 12 select options and could obtain the account object if necessary, but I still wouldn't have 12 unique accounts.
I've been attempting to use methods that looks something like this:
public class MultiTaskCreate{
public list<sSelectOption>MS {get; set;}
public map<string,string>params;
public SiteTaskSettings__c fsentries = SiteTaskSettings__c.getOrgDefaults();
public MultiTaskCreate(){
params = getparamsmap();
getwrapper();
}
public map<string,string> getparamsmap(){
map<string,string> p = ApexPages.currentPage().getParameters();
return p;
}
public class aIds{
public Id customerId {get; set;}
public Id clientId {get; set;}
public aIds(){
map<string,string>prms = getparamsmap();
Id cId = params.get('id');
Id clId = params.get('clientId');
this.customerId = cId;
this.clientId = clId;
}
}
//This method builds our list of SelectOptions
public list<sSelectOption> getWrapper() {
if(MS == null) {
MS = new list<sSelectOption>();
aIds acctIds = new aIds();
string bId;
string dId;
SelectOption Opt;
list<string>boxIds = new list<string>();
list<string>descrIds = new list<string>();
list<SelectOption>Options = new list<SelectOption>();
String Descrip = '';
Options = getOptionsList();
for(integer i=0;i<Options.size();i++){
if(i<10){
bId = '1100'+ string.valueOf(i);
dId = '2100'+ string.ValueOf(i);
}else if(i>=10){ // remove 1 digit from base number
bId = '110'+ string.valueOf(i);
dId = '210'+ string.ValueOf(i);
}
boxIds.add(bId);
descrIds.add(dId);
Opt = Options[i];
// As each Option is processed we create a new sSelectOption object and add it to the sSelectOption List
MS.add(new sSelectOption(bId, acctIds, Opt, dId, Descrip));
}
}
return MS;
}
public class sSelectOption {
public string bId {get; set;}
public aIds AD {get; set;}
public SelectOption opt {get; set;}
public string dId {get; set;}
public string Descr {get; set;}
public sSelectOption(string bId, aIds AD, SelectOption opt, string dId, string Descr){
this.bId = bId;
this.AD = AD;
this.opt = opt;
this.dId = dId;
this.Descr = 'Description';
}
}
public list<SelectOption> getOptionsList(){
list<string>valuesList = new list<string>();
list<SelectOption>Values = new list<SelectOption>();
string fSPE = string.valueOf(fsentries.Field_Service_PickEntries__c);
valuesList = split.fSPE('(,)',0);
for(string v:ValuesList){
Values.add(new SelectOption(v,v));
}
return Values;
}
public PageReference getRetURL(){
string ReturnPage = ApexPages.currentPage().getParameters().get('retURL');
return new PageReference(ReturnPage);
}
public PageReference processSelected() {
// Place holder for collecting selected and assembling tasks
// list<string>selectedOptions = new list<string>();
// list<string>selectedDescr = new list<string>();
// map<string,SelectOption>posOption = new map<string,SelectOption>();
// map<string,string>posDesc = new map<string,string>();
}
}
From the options checked, multiple tasks will be created for the cId referencing the clientId. In my view, I don't even need to pass them as part of the wrapper, but I just happened to try it this time around since nothing else has seemed to work.
Based on this blog post by Mike Leach Salesforce Apex Wrapper Class and something @AndrewFawcett wrote in this answer to Visualforce Remoting - Passing wrapper class object as a parameter, its my impression they can only be written for sObjects. Can confirm this or demonstrate a method that works for something other than sObjects?
It's possible the issue I'm having is with trying to pass parameters through the class that aren't actual fields. At this point, I'm so frustrated I don't really know. To me, "selected" doesn't seem much different than a "state" or a "parameter" compared to the Id of a checkbox, but perhaps I'm mistaken.
not API accessible
. Stripped it down to the barest of bones at one point and still no joy.Entity is not API Accessible
- I've seen this before when I used an Sobject name as a custom type in some context where the compiler thought it could be a legitimate SObject type (e.g.Product
instead ofProduct2
ormyCustomProductType
)