O'Reilly logo

The Developer’s Guide to the Force.com Platform by Phil Choi, Andrew Fawcett, Glen Martin, Rick Greenwald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Catch Those Errors

Whenever your application attempts to write data to the Force Platform database, there is a chance that an error can occur during the process. For instance, even if you have created an exquisitely perfect data interaction, someone else’s interaction with the underlying data might throw everything off.

For this reason, always include error handling code whenever your application writes to the database. This code gives you a way to handle the most difficult part of quality assurance for any application—the ability to fail (somewhat) gracefully.

9.
Modify the code in your save method to match the code below by adding the highlighted code:
public PageReference save() {
       if (PositionTypeID == 'other') {
       try{ newPositionType.Department__c ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required