You need to sign in to do that
Don't have an account?
Begginer
Could anyone help me with the issue?Error: customwrappersample Compile Error: Initial term of field expression must be a concrete SObject: List<Account> at line 8 column 5
Controllerclass
public class customwrappersample
{
public List<customerwrapperclass> lstwrapper {get;set;}
public void LoadData()
{
lstwrapper = new list<customerwrapperclass>();
List<Account> lstaccounts = [select id, name, rating, phone, billingcity from account limit 10];
if(!lstaccounts.isEmpty)
{
for(account acc : lstaccounts)
{
lstwrapper.add(new customerwrapperclass(acc , false));
}
}
List<contact> lstcontacts = [select id, firstname, lastname, phone,email, mailingcity from contact limit 10];
if(!lstcontacts.isEmpty)
{
for(contact con: lstcontacts)
{
lstwrapper.add(new customerwrapperclass(con,false));
}
}
List<lead> lstleads = [select id, firstname, lastname, phone,email, city from lead limit 10];
if(!lstleads.isEmpty)
{
for(lead ld: lstleads)
{
lstwrapper.add(new customerwrapperclass(ld,false));
}
}
}
}
public class customwrappersample
{
public List<customerwrapperclass> lstwrapper {get;set;}
public void LoadData()
{
lstwrapper = new list<customerwrapperclass>();
List<Account> lstaccounts = [select id, name, rating, phone, billingcity from account limit 10];
if(!lstaccounts.isEmpty)
{
for(account acc : lstaccounts)
{
lstwrapper.add(new customerwrapperclass(acc , false));
}
}
List<contact> lstcontacts = [select id, firstname, lastname, phone,email, mailingcity from contact limit 10];
if(!lstcontacts.isEmpty)
{
for(contact con: lstcontacts)
{
lstwrapper.add(new customerwrapperclass(con,false));
}
}
List<lead> lstleads = [select id, firstname, lastname, phone,email, city from lead limit 10];
if(!lstleads.isEmpty)
{
for(lead ld: lstleads)
{
lstwrapper.add(new customerwrapperclass(ld,false));
}
}
}
}
Begginer ,
You missed () at line nmber 8.
try this Let me know if you have any issues.
Mark it as best answer if it works.
Thanks.
All Answers
Begginer ,
You missed () at line nmber 8.
try this Let me know if you have any issues.
Mark it as best answer if it works.
Thanks.
Please check it once and let me know.
Source:http://www.solutions.forcetree.com/2015/11/error-commonexceptionsqldupvalonindexex.html
Or It may be bug:
https://success.salesforce.com/ideaView?id=08730000000DpYoAAK
Thanks.