This chapter provides an overview of PeopleCode, events and how PeopleCode programs are associated with events, as well as discusses how to:
Understand automatic backup of PeopleCode.
Access PeopleCode in PeopleSoft Application Designer.
Access record field PeopleCode.
Access component record field PeopleCode.
Access component record PeopleCode.
Access component PeopleCode.
Access page PeopleCode.
Access menu item PeopleCode.
Copy PeopleCode with a parent definition.
Upgrade PeopleCode programs.
Every PeopleCode program is associated with some aspect of a PeopleSoft Application Designer definition and an event. Events are predefined points either in the Component Processor flow or in the program flow. As each event is encountered, it fires on each component, triggering any PeopleCode program associated with that component and that event. Each definition in PeopleSoft Application Designer can have an event set, that is, a group of events appropriate to that definition. A definition can have zero or one PeopleCode programs for each event in its event set.
Some definitions have events that fall outside the Component Processor flow. These definitions include Application Engine programs, component interfaces, and application packages. In addition, security has a signon “event”. These events are described in the documentation for the definition or topic.
See Also
Understanding PeopleSoft Security
Understanding PeopleSoft Mobile Agent
A PeopleCode program is automatically saved to a file while you’re working on it. This checkpoint occurs at the following times:
Every 10 keystrokes.
On a save command, just prior to the save being executed (in case the save does not actually execute because the code is invalid).
When another PeopleCode program is selected to be edited (if you have two PeopleCode editor windows open at the same time, and you move from one to the other).
The file is saved to your temp directory (as specified in your environment), in a file with the following name:
PPCMMDDYY_HHMMSS.txt
where MMDDYY represents the month, date, and year, respectively, of the checkpoint, and HHMMSS represents the hour, minute, and second, respectively.
The top of the checkpoint file contains the following information:
[PeopleCode Checkpoint File] [RECORD.recordnameFIELD.fieldnameMETHOD.eventname]
If your PeopleCode program is saved successfully, any checkpoint files associated with that program are automatically deleted.
You can access PeopleCode associated with PeopleSoft Application Designer definitions in several ways.
With record fields and pop-up menu items, the Project view displays PeopleCode programs within the project hierarchy using a lightning bolt symbol. The programs are children of the fields and pop-up menu items with which they’re associated, and are named according to their associated events, such as ItemSelected, RowInit, or SaveEdit, as shown in the following illustration. Double-click a record field or pop-up menu item program in the Project view to start the PeopleCode Editor and load that program for editing.
PeopleCode programs in the Project view hierarchy
You can associate PeopleCode with other types of definitions, such as:
Components
Pages
Component interfaces
Such PeopleCode programs do not appear in the Project view. Instead, right-click the definition’s name and select View PeopleCode. You can also access these programs from their associated definitions.
PeopleCode can also be associated with:
Component records (specific records included in components).
Component record fields (specific record fields included in components).
Because component record fields and component records do not appear in the Project view, you must access their associated programs through their parent definitions.
See Also
Accessing Record Field PeopleCode
Accessing Component PeopleCode
This section provides an overview of the record field event set and discusses how to:
Access record field PeopleCode from a record definition.
Access record field PeopleCode from a page definition.
A record is a table-level definition. There are different types of record definitions, such as Structured Query Language (SQL) table, dynamic view, derived/work, and so on.
Record fields are child definitions of records. Record field PeopleCode programs are child definitions of record fields. A record field can have zero or one PeopleCode programs for each event in the record field event set.
The following are the events that are associated with a record field:
FieldChange Event
FieldDefault Event
FieldEdit Event
FieldFormula Event
RowInit Event
RowSelect Event
RowDelete Event
PrePopup Event
SaveEdit Event
SavePreChange Event
Workflow Event
SavePostChange Event
SearchInit Event
SearchSave event
See Also
PeopleCode and the Component Processor
Record definition fields that have PeopleCode associated with them appear bold in record views.
Record definition with three fields with PeopleCode
In the previous example, the first three fields (in bold) have PeopleCode associated with them. If you expand the subrecords in a record definition, any fields in the subrecord that have PeopleCode associated with them appear in bold.
To access record field PeopleCode from an open record definition:
Click the PeopleCode Display button on the toolbar.
A grid appears with a column for each event in the record field event set. Each cell represents a field-event combination. The column names are abbreviations of the record field event names, for example, FCh for the FieldChange event and RIn for the RowInit event. A check mark appears in the appropriate cell for each field/event combination that has an associated PeopleCode program.
Access the PeopleCode.
You can access the PeopleCode for a cell using one of these methods:
Double-click the cell.
Right-click the cell and select View PeopleCode.
Select View, PeopleCode.
The PeopleCode Editor appears. If the field/event combination has an associated program, it appears in the editor.
See Also
Understanding Record Field PeopleCode
You can associate a PeopleCode program with any page control that you can associate with a record field.
To access record field PeopleCode from a page definition, right-click a page control and select View Record PeopleCode. The PeopleCode Editor appears, displaying the first event in the event set associated with that control’s underlying record field.
Button controls are a special case. You can associate a PeopleCode program with a button only if its destination is defined as PeopleCode Command. When the user clicks a button defined using this method, the FieldEdit and FieldChange events are triggered, so the PeopleCode must be associated with one of those two events. Typically, you use the FieldChange event. The following example shows button properties:
Page Field Properties dialog box for buttons
To define a command button:
In the page definition, double-click the button to access its properties.
Select PeopleCode Command as the button destination.
Select the record and field with which your button and PeopleCode are associated.
It’s best to associate the button with a derived or work record field, which separates its PeopleCode from the PeopleCode associated with any of the page’s other underlying record fields. You can then store generic PeopleCode with this field so you can reuse it with button on other pages.
Click OK to return to the page.
Right-click the button and select View PeopleCode to access the PeopleCode Editor.
See Also
This section provides an overview of component record field PeopleCode and discusses how to access component record field PeopleCode.
Component record field PeopleCode is associated with a record field, but only with respect to a component and one of its events. Use this type of association to tailor your programs to a particular component. This PeopleCode is only accessible through the component structure view, not from a record definition.
The following events are associated with a component record field:
FieldChange Event
FieldDefault Event
FieldEdit Event
PrePopup Event
See Also
PeopleCode and the Component Processor
To access PeopleCode associated with a component record field, open the component, click the Select tab, select a field, right-click the field name, and select View PeopleCode. A lightning bolt appears next to the field name if PeopleCode is associated with the field at the component level. If PeopleCode is associated with the field at the record level, a lightning bolt does not appear, as shown in the following illustration:
Note. The Structure tab only displays the runtime state of the PeopleCode. That is, it only displays record field PeopleCode. For example, PeopleCode programs that are orphaned as a result of a page definition change do not appear in the Structure tab. On the other hand, these orphaned PeopleCode programs do appear in the PeopleCode Editor, which displays the design-time view of PeopleCode.
The PeopleCode Editor appears. If that field has associated PeopleCode, the first program in the component record field event set appears in the editor.
See Also
Accessing Record Field PeopleCode
This section provides an overview of component record PeopleCode and discusses how to access component record PeopleCode.
Component record PeopleCode is associated with a record definition, but only with respect to a component and one of its events. Use this type of association to tailor programs to a particular component. This PeopleCode is directly accessible through the component structure view, not from the record definition.
Search records and non-search records in components have different associated event sets. The following events are associated with component search records:
SearchInit Event
SearchSave Event
The following events are associated with component non-search records:
RowDelete Event
RowInit Event
In rare circumstances, the Component Processor does not run RowInit PeopleCode for some record fields. The Component Processor runs RowInit PeopleCode when it loads the record from the database. However, in some cases, the record can be initialized entirely from the keys for the component. When this happens, RowInit PeopleCode is not run.
RowSelect Event
SaveEdit Event
SavePostChange Event
SavePreChange Event
See Also
PeopleCode and the Component Processor
To access PeopleCode associated with a component record, open the component’s structure view, select a record, right-click the record name, and select View PeopleCode.
The PeopleCode Editor appears. If the record has associated PeopleCode, the first program in the component record event set appears in the editor.
See Also
This section provides an overview of component PeopleCode and discusses how to access component PeopleCode.
Component PeopleCode is associated with a component definition and an event.
The following events can be associated with a component:
PostBuild Event
PreBuild Event
SavePostChange Event
SavePreChange Event
Workflow Event
See Also
PeopleCode and the Component Processor
To access PeopleCode associated with a component, open its structure view, select the component name, right-click the name, and select View PeopleCode.
The PeopleCode Editor appears. If the component has associated PeopleCode, the first program in the component event set appears in the editor.
See Also
This section provides an overview of page PeopleCode and discusses how to access page PeopleCode.
Page PeopleCode is associated with a page definition. The page event set consists of a single event, the Activate event, which fires every time the page is activated. This event is valid only for pages that are defined as standard or secondary, and is not supported for subpages.
See Also
PeopleCode and the Component Processor
To access PeopleCode associated with a page, right-click any part of the page’s definition and select View Page PeopleCode.
Note. Page PeopleCode can only be accessed in this manner. You cannot access Page PeopleCode from the component definition Structure tab, from a project, and so on.
The PeopleCode Editor appears. If the page has associated PeopleCode, it appears in the editor.
Note. The term page PeopleCode refers to PeopleCode programs owned by pages. Do not to confuse page PeopleCode with PeopleCode properties related to the appearance of pages, such as the Visible Page Class property.
See Also
This section provides an overview of menu item PeopleCode and discusses how to:
Define PeopleCode pop-up menu items.
Access menu item PeopleCode.
See Also
PeopleTools menus are either one of two types, pop-up and standard, both of which are standalone definitions in the project hierarchy. However, you can only associate PeopleCode with menu items in pop-up menus.
The menu item event set consists of a single event, the ItemSelected Event. This event fires whenever an user selects a menu item from a pop-up menu.
Note. Do not confuse menu item PeopleCode with PeopleCode functions related to the appearance of menu items, such as CheckMenuItem.
See Also
To define a PeopleCode pop-up menu item:
In the open pop-up menu definition, double-click the menu item to access its properties.
If you’re creating a new menu item, double-click the empty rectangle at the bottom of the pop-up menu.
The Menu Item Properties dialog box appears.
If this is a new menu item, enter a name and a label for the item.
Select PeopleCode from the Type group.
Click OK to close the Menu Item Properties dialog box.
To access pop-up menu item PeopleCode:
Open the pop-up menu definition.
Right-click the menu item and select View PeopleCode.
The PeopleCode Editor appears with that menu item’s associated program, if any, displayed.
When you copy a PeopleSoft Application Designer definition that contains PeopleCode, you can choose whether to copy all PeopleCode programs and the definition. Each copy of the definition receives a separate copy of the PeopleCode programs.
To copy a definition with its PeopleCode:
Open the definition you want to copy.
Select File, Save As.
The Save As dialog appears. Type a name for the new definition in the dialog box.
Click OK, then click Yes to copy the PeopleCode.
Click Yes to copy all PeopleCode associated with the definition.
You can upgrade PeopleCode programs independently of the definitions with which they’re associated. Refer to the upgrade instructions for your product for more details.