Accessing Record Field PeopleCode

This section provides an overview of the record field event set and discusses how to access record field PeopleCode.

A record is a table-level definition. Record definitions are of different types, such as 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. The following events are associated with a record field:

  • FieldChange

  • FieldDefault

  • FieldEdit

  • FieldFormula

  • RowInit

  • RowInsert

  • RowSelect

  • RowDelete

  • PrePopup

  • SaveEdit

  • SavePreChange

  • Workflow

  • SavePostChange

  • SearchInit

  • SearchSave

Image: Record definition showing three fields associated with PeopleCode

This image is an example of Record definition. This shows three fields associated with PeopleCode which appear in bold type in record views.

Record definition showing three fields associated with PeopleCode

In the previous example, the first three fields (in boldface font) 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 also appear in bold type.

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

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 the underlying record field of that control.

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:

Image: Page Field Properties dialog box for buttons

The following image illustrates Page field properties for buttons.

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.

    You should associate the button with a derived/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 that you can reuse it with buttons on other pages.

  4. Click OK to return to the page.

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