Mapping Application Class PeopleCode to Component Events

The PeopleSoft Related Content Framework can also be used to map application class PeopleCode programs to component level, page level, and component record level events. This allows custom PeopleCode programs to be defined for a component without customizing the component definition in Application Designer. These custom PeopleCode programs can be configured to run before or after any PeopleCode program defined for the same event from the component definition.

Note: While the PeopleSoft Related Content Framework is used to complete this configuration, these PeopleCode programs do not constitute or render as related content.

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.

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

Image: Event Mapping page

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

Event Mapping page

Field or Control

Definition

Find

Click the Find button to open the Event Mapping References page in a secondary window to search by application package and class.

Search

Enter a search term or phrase and click the Search button to filter the list of content references using the search terms.

Search terms are case insensitive and results are returned for partial word matches. For example, both dep and dept will match the Department (DEPT_TBL.GBL) content reference. When you click the Search button, a database search is performed on the following values:

  • Content reference name

  • Content reference label

  • Values stored in the KEYWORD content reference attribute.

See “Content Reference Attributes” in Defining Content References.

Content Reference

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

Edit

Click an Edit button to edit an existing PeopleCode configuration.

See Assigning Application Class PeopleCode to Component Events.

Remove

Click a Remove button to remove an existing PeopleCode configuration.

Map Application Classes to Component Events

Click this link to access the Select a Content Reference page to select an application page and create a new PeopleCode configuration.

Searching by Application Package and Class

The Event Mapping References page, which allows you to search by application package and class, allows you to assess the impact to components, pages, records, and fields that have been configured with the specified application class.

Image: Event Mapping References page

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

Event Mapping References page

Field or Control

Definition

Package

Select the application package.

Path

Select the qualified subpackage or class path.

Class Name

Select the application class.

Search

Click the Search button to find components that have been configured to execute this PeopleCode.

Selecting an Application Page (Content Reference)

Use the Select a Content Reference page to select an application page and create a new PeopleCode configuration.

Image: Select a Content Reference page

This example illustrates the fields and controls on the Select a Content Reference page. You can find definitions for the fields and controls later on this page.

Select a Content Reference page

Field or Control

Definition

Include hidden Crefs

Select to make hidden content references available for assignment.

Note: The tree shows both PeopleSoft component URLs and PeopleSoft component-based generic URLs.

Folder expand button

Click to expand the folder and display child folders and links.

Folder collapse button

Click to collapse the folder and hide all children.

[link]

Click a content reference link to select that content reference to which related content will be assigned.

After selecting a content reference, continue by configuring PeopleCode programs and events. See Assigning Application Class PeopleCode to Component Events.

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

Image: Configure Event Mapping page (1 of 2)

This example illustrates the fields and controls on the Configure Event Mapping page (1 of 2). You can find definitions for the fields and controls later on this page.

Configure Event Mapping page (1 of 2)

Image: Configure Event Mapping page (2 of 2)

This example illustrates the fields and controls on the Configure Event Mapping page (2 of 2). You can find definitions for the fields and controls later on this page.

Configure Event Mapping page (2 of 2)

Field or Control

Definition

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.

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

Important! For only those events marked with *, to allow your event mapped PeopleCode program to execute immediately rather than in deferred mode, you must ensure that another PeopleCode exists for the same event. If a PeopleCode program does not yet exist, then add a new, simple PeopleCode program to the event using the PeopleCode Editor, such as one that performs a simple variable initialization:

Local integer &i = 1;

Select

Click the Select button to 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.

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 in 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.

Processing Sequence

Select whether this application class PeopleCode is executed before or after any PeopleCode program defined for the same event from the component definition.

Page

For page level mappings, select a main page from the component definition.

Note: To select a secondary page invoked by the main page or by a subpage at any level within the component, select the Unrestricted Prompt first.

Record Name

For component record or component record field level mappings, select a record from the component definition.

Note: To select a record or derived/work record defined on any subpage or secondary page at any level within the component, select the Unrestricted Prompt first.

Field Name

For component record field level mappings, select a field from the record definition.

Note: To select a record field or derived/work record field defined on any subpage or secondary page at any level within the component, select the Unrestricted Prompt first.

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;