You need to sign in to do that
Don't have an account?
Abhishek Sharma 527
getting error in method definition apex
Hello there, I'm doing program in which based on choice account/contact or lead has to be created.
while defining parameterized method I'm getting error as Integer (datatype) does not exist
//code
public class CIS_void_nonVoid_Pts {
public string choice {get;set;}
public string Acct {get;set;}
public string con {get;set;}
public string lead {get;set;}
contact cn = new Contact();
Account ac = new Account();
lead ll = new lead();
public void choiceMethod(){
if(choice=='Acct'){
AcctCreate(String X, Integer Y);
}
else if(choice=='con'){
conCreate();
}
else if(choice =='lead'){
leadcreate();
}
}
void AcctCreate(String A, integer B){
ac.name = A;
ac.Phone = ''+B;
insert ac;
}
void conCreate(){
cn.lastname = ac.name +' '+'contact' ;
insert cn;
}
void leadCreate(){
lead ll = new lead();
ll.lastname = cn.LastName;
ll.Company = ac.name;
ll.Status = 'open - not contacted';
insert ll;
}
}
can anyone please help !!
while defining parameterized method I'm getting error as Integer (datatype) does not exist
//code
public class CIS_void_nonVoid_Pts {
public string choice {get;set;}
public string Acct {get;set;}
public string con {get;set;}
public string lead {get;set;}
contact cn = new Contact();
Account ac = new Account();
lead ll = new lead();
public void choiceMethod(){
if(choice=='Acct'){
AcctCreate(String X, Integer Y);
}
else if(choice=='con'){
conCreate();
}
else if(choice =='lead'){
leadcreate();
}
}
void AcctCreate(String A, integer B){
ac.name = A;
ac.Phone = ''+B;
insert ac;
}
void conCreate(){
cn.lastname = ac.name +' '+'contact' ;
insert cn;
}
void leadCreate(){
lead ll = new lead();
ll.lastname = cn.LastName;
ll.Company = ac.name;
ll.Status = 'open - not contacted';
insert ll;
}
}
can anyone please help !!
Can you explain more about your requirement.? What are you trying to achieve here?
Thanks!!
The method definition Apex error can be especially frustrating because it’s not always easy to identify what’s causing the problem in your code. It could be something as simple as missing brackets or quotation marks – or something more complex like incorrect variable names or data types being used. Luckily, there are several approaches you can take to troubleshoot and resolve this issue.
https://jackpotworth.com/