You need to sign in to do that
Don't have an account?
Avnit Kumar
Getting Error: Compile Error: Illegal assignment from List<System.SelectOption> to List<Id> at line 22 column 1
Hi Developers
I am new in salesforce. Can anyone help me. I'm displaying Accounts in checkbox and their related contacts in selectoption using map. but i'm getting this error
"Error: Compile Error: Illegal assignment from List<System.SelectOption> to List<Id> at line 22 column 1"
My controller page
public class mylasttask{
public list<selectoption> slist{get;set;}
public list<id> clonelist{get;set;}
public map<Account,list<selectoption>> maplist{get;set;}
public mylasttask(){
list<selectoption> slist=new list<selectoption>();
maplist= new Map<Account, list<selectoption>>();
list<Account> ac =[select id,name,(select id,name from contacts)from Account];
for(Account a: ac){
slist=new list<selectoption>();
for(Contact c: a.contacts){
slist.add(new selectoption(c.id,c.name));
maplist.put(a,slist);
}
}
}
public pagereference clonecase(){
if(slist==true){
clonelist=slist.clone();
insert clonelist;
pagereference p=Apex.CurrentPage();
p.getparameters().put('id',clonelist.id);
p.setRedirect(true);
return p;
}
}
}
Thanx in Advance
I am new in salesforce. Can anyone help me. I'm displaying Accounts in checkbox and their related contacts in selectoption using map. but i'm getting this error
"Error: Compile Error: Illegal assignment from List<System.SelectOption> to List<Id> at line 22 column 1"
My controller page
public class mylasttask{
public list<selectoption> slist{get;set;}
public list<id> clonelist{get;set;}
public map<Account,list<selectoption>> maplist{get;set;}
public mylasttask(){
list<selectoption> slist=new list<selectoption>();
maplist= new Map<Account, list<selectoption>>();
list<Account> ac =[select id,name,(select id,name from contacts)from Account];
for(Account a: ac){
slist=new list<selectoption>();
for(Contact c: a.contacts){
slist.add(new selectoption(c.id,c.name));
maplist.put(a,slist);
}
}
}
public pagereference clonecase(){
if(slist==true){
clonelist=slist.clone();
insert clonelist;
pagereference p=Apex.CurrentPage();
p.getparameters().put('id',clonelist.id);
p.setRedirect(true);
return p;
}
}
}
Thanx in Advance
hi Avnit,not sure what you need but i tryied to edit your code.pls have a look and let me know if this helps or not.
Thanks,
Manohar