+ 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.