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
kumarm009kumarm009 

Inserting Custom Object in Apex code

Hi,

 

  I am looking for a way to insert custom object in Database in Apex code.

  I am able to compute the column values of the row but not able to figure out how to create this custom object instance and store in database.

 

  Thanks for the Help.

aalbertaalbert

Are you asking how to insert a record into a custom object that is configured in your instance of salesforce.com?

 

If so, here is a simple snippet to create an Account record in Apex:

 

Account acct = new Account(); acct.Name='Test Account Name'; insert acct;

 

Much more detail in the Apex documentation guide here.

 

If its a specific issue, please post a code snippet.