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
Apex codingApex coding 

Why the records are not displayed in the UI part

Hi
 
I have created a custom object, Iam inserting the records by apex code
this is code I had wriiten
 
 
Scheduling__c sch=new Scheduling__c();

sch.Name='My Scheduling Name';
sch.Line_Description__c=sch_desc;
sch.Date__c=sch_date;
insert sch;
 
My records are inserted into Custom object but they are not visible in the UI part
 
I have checked by writing a SOQL query, Iam getting the inserted values in System.debug() when I click Run Test
 
why the records are not displayed in the view part
 
can any one suggest me a solution
 

 
carramrod81carramrod81
When you create records in your testmethod, which i'm assuming you are since you say you're hitting "Run Tests", as soon as the test is over, the database is rolled back, so your records don't exist. Testmethod is only that, a test of code coverage, and any object records created will be rolled back once the test is over.