You need to sign in to do that
Don't have an account?
Vinicius Damasceno
Create a method for inserting accounts. Line: 1, Column: 32 Unexpected token '('.
Someone can tell me why im getting this error? Its seems a good code for me.
public class AccountHandler {
public static Account insertNewAccount (String Nome){
try
{
Account acct = new Account();
acct.Name = Nome;
insert acct;
return acct;
} catch (DmlException e){
System.debug('A DML exception has ocurred: '+ e.getMessage());
return null;
}
}
}
public class AccountHandler {
public static Account insertNewAccount (String Nome){
try
{
Account acct = new Account();
acct.Name = Nome;
insert acct;
return acct;
} catch (DmlException e){
System.debug('A DML exception has ocurred: '+ e.getMessage());
return null;
}
}
}
Greetings to you!
I don't see anything visibly wrong with the above code. You might be getting this error because of the copy & paste issue. You can get characters that are not visible in the code, particularly when you copy/paste code.
Delete and re-type all the characters. Re-typing the code (not using copy/paste for anything) will fix the issue.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
I don't see anything visibly wrong with the above code. You might be getting this error because of the copy & paste issue. You can get characters that are not visible in the code, particularly when you copy/paste code.
Delete and re-type all the characters. Re-typing the code (not using copy/paste for anything) will fix the issue.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
I have gone through your issue. I pasted the same code in my org and it worked fine. It may be a bug or something. Try creating a new class with a different name and paste this code. Remember to change the class name.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com