function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
funkidfunkid 

Insert to contact object - data not showing up

Hi All,

          I am new to apex and SFDC development. I am trying to create a new account(tried contact too) using apex class and I am trying to run the following apex class on salesforce sandbox using the 'run test' button the code runs successfully but when I browse for that contact/account I am not seeing the data.

 

Could anyone explain what is going wrong here?

 

public class testAccountCopy {
public static testmethod void t1()
{
Account acct = new Account(Name = 'Siva Account', account_name_copy__c = 'Siva Account', account_category__c='Customer');
insert acct ;

}
}

IanRIanR

Hi,

 

'Run Test' is there to allow you to run your unit test classes (that is, your code decorated with @isTest)

 

Tests will not persist data into the database. This is a good thing, because you will typically create 'dummy' data and test some piece of functionality against it.

 

If you want to run some 'just testing' code, try creating a VF page, add a command button and bind it to a method that creates your Account object...

 

But before you do, I honestly recommend spending an hour or so perusing the Visualforce and Apex programming guides... Read the 'getting started' sections at least!

 

 

Good luck :)

 

 

Ian