• Avnit Kumar
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hello Peeps
I am quite new in salesforce so please anyone can help me. I have to display the Accounts in checkbox and their related contacts in selectoptions. condition is that when i tick the checkbox of any account and click on the clone button the their related contacts will be cloned. sorry forgot to tell you i've to create a custom clone button too. And i have to do this by using wrapper and map. Proper code will be appriciated.

Thanx in Advance
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