Mapping Application Class PeopleCode to Component Events

You can map application class PeopleCode programs to component level, page level, component record level, and component record field level events. This allows you to add custom PeopleCode programs to components without customizing the component definition in Application Designer. These custom PeopleCode programs can be configured to run before, run after, or override any PeopleCode program defined for the same event on the component definition.

The PeopleCode Editor provides an Event Mapping button in the Application Designer tool bar. The Event Mapping button is a visual indicator of custom PeopleCode programs mapped to events of a component, page, component record, or component record field.

The Menu search definition (PTPORTALREGISTRY) must be deployed and indexed first before you can search for and select a content reference for configuration.

Event Mapping Configurations from PeopleTools 8.54 or 8.55

If you have directly migrated PeopleTools 8.54 or 8.55 event mapping configurations via an ADS project, these configurations have an instance ID of 0, which is invalid in the current release. You will receive an error message if you attempt to open and resave such configurations. To fix this issue, manually run the UPGPT859EVM Application Engine program, which is automatically run in a standard upgrade. After running the UPGPT859EVM program, review the log file to identify the new service IDs. With this information, you can run queries to determine which configurations have been updated.

For example, this log file indicates that one instance ID was updated to 998188404:

'UPGPT859EVM' Program Started (226,2) 
. 
Current Max Instance ID:998188403 (240,4272) 
Message Set Number: 240 
Message Number: 4272 
Message Reason: Current Max Instance ID:998188403 (240,4272) 
. 
Updated Row with Instance ID 0 to 998188404 (240,4291) 
Message Set Number: 240 
Message Number: 4291 
Message Reason: Updated Row with Instance ID 0 to 998188404 (240,4291) 
. 
Updated respective map fields rows if Any, of Table:PSPTCS_MAPFLDS. 
(240,4275) 
Message Set Number: 240 
Message Number: 4275 
Message Reason: Updated respective map fields rows if Any, of 
Table:PSPTCS_MAPFLDS. (240,4275) 
. 
Section: MAIN; Step: PTUPDINS; Updated 1 Rows of Tables:PSPTCSSRVCONF , 
PSPTCSSRVCONFLG. (240,4276) 
Message Set Number: 240 
Message Number: 4276 
Message Reason: Section: MAIN; Step: PTUPDINS; Updated 1 Rows of 
Tables:PSPTCSSRVCONF , PSPTCSSRVCONFLG. (240,4276) 
. 
'UPGPT859EVM' Program Completed (226,5) 
Application Engine program UPGPT859EVM ended normally 

Using this information, you could query PSPTCSSRVCONF, PSPTCSSRVCONFLG, and PSPTCS_MAPFLDS to determine which content reference (portal object ID) was affected. For example:

SELECT * FROM PSPTCSSRVCONF WHERE PORTAL_NAME='_PTCS_PTEVMAP' AND PTCS_INSTANCEID IN (998188404);

Use the Event Mapping Configuration search page to manage which content references have associated PeopleCode application package programs.

Note: Event mapping is restricted to content references for registered components only.

Navigation:

PeopleTools > Portal > Event Mapping > Event Mapping Configuration.

This example illustrates the fields and controls on the Event Mapping Configuration search page. You can find definitions for the fields and controls later on this page.

Event Mapping Configuration search page

You can search for existing configurations by content reference label or by application package or class configured on the content reference.

Field or Control

Description

Search By

Select either:

  • Content Reference to search by content reference label.

  • Application Class to search by application package or class.

Label

When Content Reference is selected as the search type, enter a string or partial string to search on. The search results include matches on the content reference label or description.

Root Package IDPathClass ID

When Application Class is selected as the search type, enter a portion of or the fully qualified path to the application class:

  • Root Package ID: Select or enter the name of the application package that contains the application class.

  • Path: Select or enter the names of each sub-package in the application class hierarchy that define the location of the application class. Separate sub-package names by a colon. If the class is defined in the top-level application package, enter or select the colon.

  • Class ID: Select or enter the name of the application class.

Search

Click the Search button to execute the search.

Add Configuration

Click the Add Configuration button to access the Event Mapping Configuration page to search for a content reference and then add a new event mapping configuration.

See Configuring Event Mapping.

Content Reference

Click a content reference link to access the actual transaction page, which allows you to test any configured PeopleCode programs.

Edit button

Click an Edit Configuration button to modify an existing event mapping configuration.

See Configuring Event Mapping.

Remove button

Click a Remove Configuration button to remove an existing event mapping configuration.

Navigation icon

Click a Show Navigation Path button to display the full menu navigation path to the content reference.

Use the Event Mapping Configuration page to map application class PeopleCode to component level, page level, component record level, and component record field level events.

Navigation:

On the Event Mapping Configuration search page:

  • Click the Add Configuration button to search for a content reference and then add a new event mapping configuration.

  • Click an Edit Configuration button to modify an existing event mapping configuration.

Searching for a Content Reference

Note: Event mapping is restricted to content references for registered components only. Therefore, search results are filtered to include registered components only.

After clicking the Add Configuration button, enter a search term or phrase. The search results are updated as you type. Select a content reference from the search results to add a new event mapping configuration.

Searching on the Event Mapping Configuration page

Completing the Configuration

This example illustrates the fields and controls on the Event Mapping Configuration page. You can find definitions for the fields and controls later on this page.

Event Mapping Configuration page

Field or Control

Description

Event Level

Select an option to specify the event level:

  • Component

  • Page

  • Rec Field

  • Record

Unrestricted Prompt

Select the unrestricted prompt only when the item for which you are searching is not found on a page definition that is explicitly included in the component definition. This allows an unrestricted search of all matching definitions within the system.

Use the unrestricted prompt only when:

  • Searching for secondary pages invoked by the main page or by a subpage at any level within the component.

  • Searching for records, derived/work records, or record fields defined on any subpage or secondary page at any level within the component.

Note: If you return to this configuration, the unrestricted prompt check box is no longer selected. However, the actual configurations are retained. This allows you select the unrestricted prompt again if you need to reconfigure these items in an unrestricted manner.

Page or Record or Record Field

Select the page name, record name, or combination of record name and field name corresponding to the event level selected previously. If Component is selected as the event level, this field is not displayed and no selection is required.

Event Name

  • At the component level, an application class-based service can be associated with one of the following PeopleCode events:

    • PostBuild

    • PreBuild

    • SavePostChange

    • SavePreChange

    • Workflow

  • At the page level, an application class-based service can be associated with the Activate event only.

  • At the component record level, an application class-based service can be associated with one of the following PeopleCode events:

    • RowDelete

    • RowInit

    • RowInsert

    • RowSelect

    • SaveEdit

    • SavePostChange

    • SavePreChange

    • SearchInit

    • SearchSave

  • At the component record field level, an application class-based service can be associated with one of the following PeopleCode events:

    • FieldChange

    • FieldDefault

    • FieldEdit

    • SearchInit

    • SearchSave

Service ID/Application Package

Select an application class-based related content service definition.

Note: The list of application class-based services is filtered to include only those that have implemented the PT_RCF:ServiceInterface base class.

Processing Sequence

Select the processing sequence with respect to any PeopleCode program defined for the same event on the component definition:

  • Override – Select to override any PeopleCode program defined for the same event on the component definition.

  • Post – Select to execute the mapped application class after any PeopleCode program defined for the same event on the component definition.

  • Pre – Select to execute the mapped application class before any PeopleCode program defined for the same event on the component definition.

Event Map Parameter

Optionally, specify a string value to selectively invoke a specific block of code within the application class. This allows you to use a single application class in multiple configurations separating each bit of functionality into separate blocks.

This application class must implement the eve_execute method in addition to an empty execute method. Within the eve_execute body, conditional logic must evaluate the event map parameter and execute the appropriate block of code for each valid parameter value.

See the following PeopleCode example.

Sequence Number

Specify a processing sequence when more than one custom application class program is mapped to the same event.

Enable

Deselect this check box to disable execution of the application class, but retain the event mapping configuration.

Save

Click the Save button to save the configuration.

Add to Project

Click the Add to Project link to access the Add To Project page to insert this event mapping configuration into an ADS project. See Adding Data Set Instances from Object Designer Pages for more information.

PeopleCode Example for Multiple Events in a Single Application Class

The following application class presents an example of how eve_execute could be implemented:

import PT_RCF:ServiceInterface;

class App_Class1 implements PT_RCF:ServiceInterface
   method execute();
   method eve_execute(&str As string);
end-class;

method execute
   /+ Extends/implements PT_RCF:ServiceInterface.execute +/
end-method;

method eve_execute
   /+ &str as String +/
   /+ Extends/implements PT_RCF:ServiceInterface.eve_execute +/
   /* &str variable will have the Event Map Parameter that was */
   /* set in the configuration page for that particular event  */
   /* that is being triggered.                                 */
   Evaluate &str
   When = "1"
      /* Code block for PreBuild event */
   When = "2"
      /* Code block for PostBuild event */
   When-Other
      /* Code block to handle an invalid event map parameter  */
   End-Evaluate;
end-method;

Global event mapping enables you to map application class PeopleCode programs to the PostBuild event of all components at a global level.

Global events are triggered after any existing PRE/OVERRIDE/POST event mapping configurations associated with the PostBuild event of the target components are completed.

Currently, PeopleTools does not deliver a configuration page to define global events. Global events can be configured using the delivered methods of the PTCS_GLOBALEVENTMAPPING application package, such as CreateGlobalEventMappingConfig and DeleteGlobalEventMappingConfig.

For more information on the delivered methods, see GlobalEventMapping Class Methods.

Considerations for Using Global Event Mapping

When you plan to perform event mapping on a global level, you should consider the following:

  • You must ensure that global event mapping does not impact the loading of components from performance and error handling perspectives.

  • You should ensure that errors are handled gracefully.

  • You should be aware that if a page has multiple components, component-based grouplets, component-based pagelets, or component-based modals and so on, the configured global events run on each of the loaded components. Therefore, your PeopleCode logic should conditionally identify or filter the components, component-based grouplets, component-based pagelets, or component-based modals to ensure that the required logic is run only for the required components.

    For example, if a page contains a target component and a component-based grouplet, and you want to run it only for the target component, then your PeopleCode logic should perform a conditional check to exclude the component-based grouplet.

Prerequisites

Before you create a global event mapping configuration using the CreateGlobalEventMappingConfig method, you must create a related content service definition.

See Creating Service Definitions for Event Mapping for more information.

Verifying the Global Event Mapping Configuration

The following database tables – PSPTCS_SRVCFG and PSPTCSSRVCONF – store the event mapping configuration data. After you create a global event mapping configuration using the CreateGlobalEventMappingConfig method, you can verify the configuration using the following SQL statements:

  • SELECT * FROM PSPTCS_SRVCFG WHERE PORTAL_OBJNAME LIKE 'PTCS_EVMAP_GBL_%'

  • SELECT * FROM PSPTCSSRVCONF WHERE PORTAL_OBJNAME LIKE 'PTCS_EVMAP_GBL_%'

Warning! Oracle recommends that you do not directly modify these database tables containing configuration data using SQL.

You can identify the global event mapping configuration by the data contained in the PORTAL_OBJNAME and the PTCS_PROCSEQ columns of these tables.

  • In the PORTAL_OBJNAME column, identify the configuration name specified in the CreateGlobalEventMappingConfig method. The global event mapping configuration name is prefixed with PTCS_EVMAP_GBL.

    See CreateGlobalEventMappingConfig.

  • In the PTCS_PROCSEQ column, the global event mapping configuration is identified by the term GBL.