+ Start a Discussion
LathaKattaLathaKatta 

Account created thru apex is not reflecting the database

public class newaccount
{
public static void createaccount()
{
Account a= new Account();
a.Name='katta';
a.Phone='90909090';
insert a;
}
 
when i go back a see the accounts the account which i have creatwed thru the code is not present.
help me out on this?let me know like it can't be reflected to the dbor what?
send me the sample code for making this to happen because iam new to this sfdc and trying to learn
mikefmikef
Please read the section in the Apex docs, called 'Understanding the Debug Log'.
http://www.salesforce.com/us/developer/docs/apexcode/index.htm

Then use the system log console to run your code.
If there is an error the log console will fail and show the error.

You can also add System.debug() statements in your code to figure out what is going on.
System.debug() can be used like System.out.print() in Java.

The console will let you see what is going on with your code.
johutchjohutch
i'm going to cosign what mikef said:

you need to find out if the createaccount() function is being called... if the new account is not showing up in the database and your not receiving any type of error messages then the function is not being called. the debug log can tell you what is going on