You need to sign in to do that
Don't have an account?
Amit Karlekar 3
How do I solve this error - "Variable does not exist: Contact"
public class createNewAccount {
public Contact createAcc(string conName){
account acc = new account();
acc.Name = conName;
insert acc;
system.debug(acc);
contact con = new contact contact();
con.LastName = conName + 'Contact';
con.AccountId = acc.Id
insert con;
system.debug(con);
return Contact;
}
}
this is the program in which I couldn't find the error. Can somebody please help me?
public Contact createAcc(string conName){
account acc = new account();
acc.Name = conName;
insert acc;
system.debug(acc);
contact con = new contact contact();
con.LastName = conName + 'Contact';
con.AccountId = acc.Id
insert con;
system.debug(con);
return Contact;
}
}
this is the program in which I couldn't find the error. Can somebody please help me?
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
You have to remove the 'contact' in the contact object creation line.
You have missed adding the semicolon after acc.Id
You have to replace the 'Contact' with 'con' in the return statement.
Use the below code:
If this solution is helpful, Please mark it as the best answer.
Thanks & Regards,
Shams Tabrez