Populating a State Record

This article goes through a basic example of how to populate data in an application state record. State records are used in Application Engine programs to keep track of useful information through the life of a program. PeopleSoft uses the concept of a record (table) to store this information. I believe the scope of data in a state record is global to an application engine program (and other programs that share the state record), however this could be wrong.

The naming convention of state records is to end with the suffix _AET. They can either be a derived/work record or a SQL table. The difference is one of persistence. A derived/work state record will lose its value when the application engine is restarted or after database commits, while a table will not as state data is committed to the database. So if you are developing a restartable application engine program, the state record should be a table (and built in the database). Since Derived/work state records can also lose information between commits in your application engine, its safest to use a SQL table as the default type for your state records.

The following steps are involved in populating a state record in an application engine program:

Create the state record

All state records must have at least one field PROCESS_INSTANCE as their first field. This is also the only key field. Other commonly used fields are OPRID and RUN_CNTL_ID. This lets you track who is running the application engine program and what run control ID they are using. Other fields are a matter of your requirements; what information do you need to track through the execution of your program?

Remember the naming convention: state records end with the suffix _AET.

Assign the state record to your App Engine

Once you've created the state record, you need to assign it to your application engine program. You do this through the application engine properties in the state records tab. Use the search to find your state record and then add it. Note if you only have one state record it will be the default. If you have more than one, you should nominate one as the default. You can supposedly have up to 200 state records associated with one application engine program, but I'm not sure I would like to see a program that does …

Add a SQL action that populates the state record

I generally have an INIT step at the start of an application engine program that populates state records. This includes a SQL action that populates the state record.

Here's a basic example assuming a state record with the fields:


Note that you don't need to select in the PROCESS_INSTANCE field. It is automatically populated and available for use as a bind, which is how we get the operator ID and run control ID.


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License