
Force.com Cookbook Sample Code
Chapter 4: Best Practices for Writing Apex - Getting Started with Apex
To download all the code samples, access the Cookbook. -
This Apex trigger is part of a simple scenario in which Apex is used to update a custom account field named Hello with the text "World" every time a new account is created.
To use this code in your own organization, you'll first need to define a custom text field named Hello on the Account object.
trigger helloWorldAccountTrigger on Account (before insert) {
MyHelloWorld.addHelloWorld(Trigger.new);
}
Sample code provided by salesforce.com. All rights reserved.