Accessing PeopleCode and Events

This chapter provides an overview of PeopleCode, events and how PeopleCode programs are associated with events, as well as discusses how to:

Click to jump to parent topicUnderstanding PeopleCode Programs and Events

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

Component Interface Classes

Application Classes

Adding Message Definitions

Specifying PeopleCode Actions

Understanding PeopleSoft Security

Understanding PeopleSoft Mobile Agent

Click to jump to parent topicUnderstanding Automatic Backup of PeopleCode

A PeopleCode program is automatically saved to a file while you’re working on it. This checkpoint occurs at the following times:

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.

Click to jump to parent topicAccessing PeopleCode in PeopleSoft Application Designer

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:

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:

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

Click to jump to parent topicAccessing Record Field PeopleCode

This section provides an overview of the record field event set and discusses how to:

Click to jump to top of pageClick to jump to parent topicUnderstanding Record Field PeopleCode

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:

 

See Also

PeopleCode and the Component Processor

Click to jump to top of pageClick to jump to parent topicAccessing Record Field PeopleCode from a Record Definition

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:

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

  2. Access the PeopleCode.

    You can access the PeopleCode for a cell using one of these methods:

The PeopleCode Editor appears. If the field/event combination has an associated program, it appears in the editor.

See Also

Understanding Record Field PeopleCode

Using the PeopleCode Editor

Click to jump to top of pageClick to jump to parent topicAccessing Record Field PeopleCode from a Page Definition

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:

  1. In the page definition, double-click the button to access its properties.

  2. Select PeopleCode Command as the button destination.

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

  4. Click OK to return to the page.

    Right-click the button and select View PeopleCode to access the PeopleCode Editor.

See Also

Using the PeopleCode Editor

Click to jump to parent topicAccessing Component Record Field PeopleCode

This section provides an overview of component record field PeopleCode and discusses how to access component record field PeopleCode.

Click to jump to top of pageClick to jump to parent topicUnderstanding 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:

See Also

PeopleCode and the Component Processor

Click to jump to top of pageClick to jump to parent topicAccessing Component Record Field PeopleCode

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

Using the PeopleCode Editor

Accessing Record Field PeopleCode

Click to jump to parent topicAccessing Component Record PeopleCode

This section provides an overview of component record PeopleCode and discusses how to access component record PeopleCode.

Click to jump to top of pageClick to jump to parent topicUnderstanding 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:

The following events are associated with component non-search records:

See Also

PeopleCode and the Component Processor

Click to jump to top of pageClick to jump to parent topicAccessing Component Record PeopleCode

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

Using the PeopleCode Editor

Click to jump to parent topicAccessing Component PeopleCode

This section provides an overview of component PeopleCode and discusses how to access component PeopleCode.

Click to jump to top of pageClick to jump to parent topicUnderstanding Component PeopleCode

Component PeopleCode is associated with a component definition and an event.

The following events can be associated with a component:

See Also

PeopleCode and the Component Processor

Click to jump to top of pageClick to jump to parent topicAccessing Component PeopleCode

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

Using the PeopleCode Editor

Click to jump to parent topicAccessing Page PeopleCode

This section provides an overview of page PeopleCode and discusses how to access page PeopleCode.

Click to jump to top of pageClick to jump to parent topicUnderstanding 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

Click to jump to top of pageClick to jump to parent topicAccessing Page PeopleCode

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

Page Class

Using the PeopleCode Editor

Click to jump to parent topicAccessing Menu Item PeopleCode

This section provides an overview of menu item PeopleCode and discusses how to:

See Also

Creating Menu Definitions

Using the PeopleCode Editor

Click to jump to top of pageClick to jump to parent topicUnderstanding Menu Item PeopleCode

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

ItemSelected Event

Click to jump to top of pageClick to jump to parent topicDefining PeopleCode Pop-Up Menu Items

To define a PeopleCode pop-up menu item:

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

  2. The Menu Item Properties dialog box appears.

    If this is a new menu item, enter a name and a label for the item.

  3. Select PeopleCode from the Type group.

  4. Click OK to close the Menu Item Properties dialog box.

Click to jump to top of pageClick to jump to parent topicAccessing Menu Item PeopleCode

To access pop-up menu item PeopleCode:

  1. Open the pop-up menu definition.

  2. Right-click the menu item and select View PeopleCode.

    The PeopleCode Editor appears with that menu item’s associated program, if any, displayed.

Click to jump to parent topicCopying PeopleCode with a Parent Definition

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:

  1. Open the definition you want to copy.

  2. Select File, Save As.

    The Save As dialog appears. Type a name for the new definition in the dialog box.

  3. Click OK, then click Yes to copy the PeopleCode.

    Click Yes to copy all PeopleCode associated with the definition.

Click to jump to parent topicUpgrading PeopleCode Programs

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.