Application Engine On-Exit Plugins

App Engine On Exit Plugin

An Application Engine On-exit plugin is a new PeopleTools feature that allows you to invoke an SQL or PeopleCode action at the end of any App Engine program.
This was released in PeopleTools 8.59.

Configuring On-Exit Plugin

App Engine on-exit plugins can be configured online through the AE Action Plugins page. This is the same page that is used to configure App Engine Action plugins.

Navigation: PeopleTools > Application Engine > AE Action Plugins

Open the App Engine that needs to have an on-exit plugin configured.

Search On Exit Plugin

Now, in the On-Exit Plugin grid, select the Plugin App Engine, its Section, Step and Action.

We can invoke the on-exit plugin upon encountering any of the following exit conditions.

  • On Success
  • On Skip Step
  • On Break
  • On Abort

At least one of these conditions must be selected.

If none of them is selected, the following error is thrown at save.

Error On Exit Plugin

If more than one condition is selected, %AEExitReturnCode which is discussed later in the article would come in handy.

Configure On Exit Plugin

Application Libraries

Application Libraries are Applications Engines without the Main Section. These can only be called from another App Engine.

On-exit plugins can be configured for Application Libraries as well.

How does it show up in App Designer?

I’ve configured an on-exit plugin for my test App Engine. Let’s look at how this is displayed within App Designer.

Definition view

There are no indicators in the Definition view to alert the developer that the App Engine has an on-exit plugin configured. It would have been helpful to have this prominently displayed when the AE is open.

AE Definition View

Program Flow view

The Program Flow displays a text highlighting that an On-exit plugin has been configured. The App Engine name Section, Step and action of the plugin are also displayed.

However, it doesn’t let you right-click and open the on-exit plugin app engine.

On Exit Plugin Program Flow

If the changes don’t show up in the program flow, purging cache directories from the Configuration Manager can help.

Config Manager Purge Cache

Sharing State Records and Temporary Tables

The State records and Temp tables of the configured App Engine are available for use within the On-exit plugins.

Consideration should be given to the fact that the configured App Engine could have rolled back the changes if it had landed in error.

Tracing

When you have turned on tracing on an App Engine that has an on-exit plugin configured is traced, the entire process (including the plugin) is traced.

Tracing an App Engine Plugin

Onexit Plugin Trace File

Related System Variables

%AECallerApplId

Within an App Engine plugin, this system variable can be used to identify the App Engine that has invoked the plugin.
This could be useful when a plugin is used in more than one App Engine and you need to know where it was called from to trigger some specific logic.

%AEExitReturnCode

This system variable can be used to identify the status of the PeopleCode or SQL action that was executed before the on-exit plugin was invoked.

SQL PeopleCode %AEExitReturnCode
Abort Abort 100
Section Break Break 101
Continue 0
Skip Step Skip Step 102

%AEExitReturnCode also returns 0 when the last executed action is neither PeopleCode nor SQL. This is the case when it is executed not as an on-exit plugin too.

%AEExitReturnCode

%AEExitReturnCode Message

Migrating On-Exit Plugin

The configurations for On-exit plugins can easily be migrated using the Data Migration Workbench.

The data set name for this is PT_AE_ON_EXIT_PLUGIN

On Exit Plugin Data Set Name

After adding PT_AE_ON_EXIT_PLUGIN, search for the Program and select the required plugins.

Migrate On Exit Plugins

Add this to your Data Migration Workbench project and you are ready to copy the DMW project to a file!

Over to you

What are some of the use cases where you would consider using On-exit plugins?
Let me know in the comments.

Tags: , ,
Leave a Reply

Your email address will not be published. Required fields are marked *

*
*