function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Neha Sameen 1Neha Sameen 1 

"Variable does not exist: Name" for account object

I am getting "Variable does not exist: Name" for account object. For as far i know, for field "AccountName" field name is "Name". Then why i m getting this error. Please help.
Ankit Maheshwari 2Ankit Maheshwari 2
Hi Neha,

Could you please share the code snipt by which I can take a look into it?

Thanks
Ankit Maheshwari
Neha Sameen 1Neha Sameen 1
public class AccountHandler {
public static Account insertNewAccount(String name) {
Account acc = new Account();
acc.Name = name;
try
{
insert acc;
} catch (Exception e) {
return null;
}
return acc;
}
}


error is "Variable does not exist: Name"
Ankit Maheshwari 2Ankit Maheshwari 2
Have you saved this class or at the time of saving class you are getting this issue?
Neha Sameen 1Neha Sameen 1
At the time of saving i get this also. I also tried to execute below code
Account acct = new Account();
        acct.Name = 'Test';

From execute anonymous window, but getting the same error 
Ankit Maheshwari 2Ankit Maheshwari 2
Just to let you know that I saved the same class and did not get any issue. and it is working.
Neha Sameen 1Neha Sameen 1
Actually, its not only working in my Account only. So, i just want to know the reason.