You need to sign in to do that
Don't have an account?
Reddy
Compile Error: Initial term of field expression must be a concrete SObject: List<Account> at line 18 column 41
public class AccountInsert{
public string accName{get;set;}
public string accindustry{get;set;}
public pagereference create(){
list<Account> acc =[select id, name, industry from Account where name=:accname ];
if(acc.size()>0){
apexpages.message msg=new Apexpages.Message(apexpages.Severity.Error, 'duplicate records Exit');
apexpages.addMessage(msg);
return null;
}
else{
account a=new Account();
a.name='accname';
a.industry='accIndustry';
insert a;
}
pagereference p=new pagereference('/'+ acc.id);
return p;
}
}
public string accName{get;set;}
public string accindustry{get;set;}
public pagereference create(){
list<Account> acc =[select id, name, industry from Account where name=:accname ];
if(acc.size()>0){
apexpages.message msg=new Apexpages.Message(apexpages.Severity.Error, 'duplicate records Exit');
apexpages.addMessage(msg);
return null;
}
else{
account a=new Account();
a.name='accname';
a.industry='accIndustry';
insert a;
}
pagereference p=new pagereference('/'+ acc.id);
return p;
}
}
try this onces let me inform if it helps you
thanks
All Answers
try this onces let me inform if it helps you
thanks
Its working but what is debug code.
AccountInsert ai=new AccountInsert();
ai.create();
or
AccountInsert ai=new AccountInsert();
ai.pagereference();
pls let tel me
allways debug code will be written by
ClassName ver=new Classname();
ver.Constructor();------------- syntax.
jest tell me