You need to sign in to do that
Don't have an account?
Manish Anand 10
Trailhead challenge:Manipulating records with DML
Hi,
For this challenge, I have written below code:
public class AccountHandler {
public static Account insertNewAccount(string str1)
{
try{
Account acct=new Account(Name=str1);
insert acct;
return acct;
}
catch (DMLException e)
{
System.debug('A DML exception has occurred: ' +
e.getMessage());
return (NULL);
}
}
}
This shows 0 compile time error, as well as I got the points for this.
However, when I debug it through, 'Open Execute Anonymus Window' by passing paramter 'AcmeTest' , as shown below.
AccountHandler.insertNewAccount(acmeTest);
It gives error- Line 1, column:33
Variable doesn't exist:acmeTest
what I am missing, here?
For this challenge, I have written below code:
public class AccountHandler {
public static Account insertNewAccount(string str1)
{
try{
Account acct=new Account(Name=str1);
insert acct;
return acct;
}
catch (DMLException e)
{
System.debug('A DML exception has occurred: ' +
e.getMessage());
return (NULL);
}
}
}
This shows 0 compile time error, as well as I got the points for this.
However, when I debug it through, 'Open Execute Anonymus Window' by passing paramter 'AcmeTest' , as shown below.
AccountHandler.insertNewAccount(acmeTest);
It gives error- Line 1, column:33
Variable doesn't exist:acmeTest
what I am missing, here?
you need to make your parameter a string, by wrapping it in single quotes:
otherwise I thinks it is a variable name.
All Answers
you need to make your parameter a string, by wrapping it in single quotes:
otherwise I thinks it is a variable name.