You need to sign in to do that
Don't have an account?
SV M
DML requires SObject or SObject list type: AccountClass
Here is my apex class
public class AccountClass
{
public void createAccount(String Name)
{
AccountClass acc = new AccountClass();
acc.Name = 'Test';
insert acc;
}
}
I am getting the following error while compiling,
DML requires SObject or SObject list type: AccountClass.
Can anyone help me how to resolve this error also tell me how to execute this class using Developer Console
public class AccountClass
{
public void createAccount(String Name)
{
AccountClass acc = new AccountClass();
acc.Name = 'Test';
insert acc;
}
}
I am getting the following error while compiling,
DML requires SObject or SObject list type: AccountClass.
Can anyone help me how to resolve this error also tell me how to execute this class using Developer Console
You are giving accountclass instead of account.When creating an object record you have create a varibale to type Sobject.Here in your case Account
Try this code.
To execute
Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.
Thanks and Regards
Even after changing the class name I am still getting the errors. Can you help me resolve those errors.
Thank You.
Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.
Thanks and Regards