By Chris Malek | 07 November 2011
The only Peoplecode events you should be using
When designing pages and components in PeopleTools, there are many different peoplecode events that you can use. In fact, there are too many options. We write alot of PeopleCode and here is our opinion of where 95% of your code should be. You generally want to place 99% of your code at the component level and not at the record level.
PeopleCode events to use
- Component PostBuild
- For code you need to trigger once when the component loads.
- Component SavePostChange
- For updating other records and sending notifications after the transaction has committed.
- Component Record FieldChange
- For record field change peoplecode. Add it at the component level always not at the record level. If you need the same behavior across components, then create a function.
- Component Record RowInit
- For logic you need to trigger when a row is loaded from the database. Add it at the component level always not at the record level. If you need the same behavior across components, then create a function.
- Component Record SaveEdit
- For enforcing valid fields and such. Notice we do not add it at the component record.field level. We have every piece of validation logic in one event so it is easier to modify later.
PeopleCode Events to avoid
These are the events where you generally do not want to place any code.
- Page Activate
- See the related article: Stop using page Activate PeopleCode
- Record level FieldChange
- Record Level RowInit
- Record level FieldEdit
- Record Field Default