+ Start a Discussion
Aidel BruckAidel Bruck 

INVALID_FIELD_FOR_INSERT_UPDATE, Account: bad field names on insert/update call: Name: [Name]

This is the error i am getting when I run this

 static Account createNewaccount()
    {
        Account newaccount= new Account(Name= 'test');
        newaccount.RecordTypeID= '012A0000000E3yA';
        insert newaccount;
        return newaccount;
        
    }
Best Answer chosen by Aidel Bruck
Anoop yadavAnoop yadav
Hi,
Then you should use FirstName and LastName
instead of Name

All Answers

Anoop yadavAnoop yadav
Hi,
Do you have Person Account Enabled in your Account?

Try Like below.
static Account createNewaccount()
    {
        Account newaccount= new Account();
        newaccount.RecordTypeID= '012A0000000E3yA';
        newaccount.Name= 'test';
        insert newaccount;
        return newaccount;       
    }
Aidel BruckAidel Bruck
I did. 
still getting this error
Anoop yadavAnoop yadav
Hi,
Is the above one Business Account Id?
Aidel BruckAidel Bruck
no, person
Anoop yadavAnoop yadav
Hi,
Then you should use FirstName and LastName
instead of Name
This was selected as the best answer
Aidel BruckAidel Bruck
Thank you for your help