Stop PeopleCode Processing for Debugging


A blunt, but useful method for debugging PeopleCode is to use the inbuilt Error function to stop processing and provide a message.

Something as simple as this can be a valuable debugging tool at times:

Error "The value of variable x=" | &x;

Most people use MessageBox (or the now very deprecated WinMessage), but at times this may not appear depending on the context of the PeopleCode you are executing. Error stops processing (a poor man's breakpoint) so you can find out what's going on at that exact point in the code.

NOTE: The Error function causes a rollback of any pending database transactions, so if you need to store the state of the DB, put in a commit (e.g. SQLExec("commit") on Oracle) before throwing the error.

Revision #2
Created Tue, Jul 23, 2019 8:03 PM by PeopleSoft Wiki
Updated Wed, Jul 24, 2019 2:47 PM by PeopleSoft Wiki