Use DML to Save sObjects to the Database
Follow Along with Trail Together
Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series.
(This clip starts at the 21:37 minute mark, in case you want to rewind and watch the beginning of the step again.)
Create and Adjust the sObjects
Create a Recruiting Account sObject and save it to the database.
- In the Developer Console, open the Execute Anonymous window.
- Replace the existing code with this code:
- Verify that Open Log is selected and then click Execute. The execution log opens.
- Select Debug Only.
- Review the debug message and then close the log.
Within the createContact method, create a Contact sObject, populate its attributes, add it to the conList, and save the list to the database.
- In the CreateContactFromCan class, replace the existing code with this code:
- Save the CreateContactFromCan class.