Using the PeopleCode and Other Programming Language Editors

This section provides an overview of PeopleCode and discusses how to use the various programming language editors.

Note: When using the programming language editors, keep these items in mind.

Highlighting the syntax of strings in the HTML Editor and the PeopleCode Editor is done only for single-line strings, not for multi-line strings.

Word wrap can cause strings to be displayed in various colors if the strings span across multiple lines.

String color-coding, when used with an escape sequence, may be displayed incorrectly in Application Designer but perform properly at runtime.

PeopleCode is the structured programming language built into PeopleTools that extends the functionality of the PeopleTools environment, enabling you to add business logic to critical application definitions. All PeopleCode programs are associated with and considered a part of the parent definition. When you create, view, or modify a definition, you may simultaneously create, view, or modify its PeopleCode.

You can associate PeopleCode programs with many items, such as record fields, pages, components, Application Engine programs, and so on. You can access any PeopleCode program from its related definition. When you have a definition open in Application Designer, you can access the PeopleCode written for that definition by:

  • Clicking the View PeopleCode button in the toolbar.

  • Right-clicking on the definition and selecting View PeopleCode from the popup menu.

Field or Control

Definition

View PeopleCode button

For definitions where PeopleCode can be inserted, the View PeopleCode button appears in the dynamic Application Designer toolbar. Click this button to launch the PeopleCode Editor and view the PeopleCode associated with the current definition.

The View PeopleCode button appears for these definition types:

  • records

  • pages

  • components

  • menus

  • component interfaces

  • messages

  • Application Engine programs

Note: Depending on the definition type, the label of the button and the number of buttons that appear might be different. For example, with pages, you see two buttons: View Page PeopleCode and View Record PeopleCode.

Image: Example of accessing PeopleCode from the popup menu

This example illustrates accessing PeopleCode from the current definition open in the Application Designer workspace. By selecting View PeopleCode from the popup menu, the system launches the PeopleCode Editor displaying the PeopleCode for the selected record field.

Example of accessing PeopleCode from a record definition by right-clicking

To view Record Field PeopleCode there is an additional option:

  1. Open a record definition in PeopleSoft Application Designer.

  2. Click the View PeopleCode toolbar button to view the PeopleCode display for the record.

  3. Locate the field containing PeopleCode in the record definition for which you want to access the PeopleCode.

  4. Double-click the cell (the check mark)l under the column heading for the type of PeopleCode that you want to view.

The PeopleCode editor is a text editor that enables you to construct, modify, and review PeopleCode programs and associate them to PeopleSoft definitions and events. The PeopleCode editor enables you to edit and navigate all PeopleCode programs that belong to the same parent definition.

The user interface of the PeopleCode editor consists of two drop-down lists boxes and an area where you enter text. The drop-down list box that is on the left side of the editor is a displays the current field and other available fields, records, and components. Any field with PeopleCode attached appears in bold. The drop-down list box that is on the right side of the editor displays the current PeopleCode event and other events that are appropriate for that definition. Events already containing PeopleCode for that definition appear in bold.

Beneath the drop-down list boxes is where you enter your text. In this area, you can add, delete, and change text and you can use the find and replace function. The PeopleCode editor validates the syntax of your code and the editor automatically formats the code according to PeopleSoft standards when you save the definition.

Image: Example of working in the PeopleCode editor

This example illustrates the fields and controls on the Example of working in the PeopleCode editor. You can find definitions for the fields and controls later on this page.

Example of working in the PeopleCode Editor

Note: You can embed strings in the PeopleCode editor that generate HTML, JavaScript, CSS, and XML markup. However, it is not considered a best practice.

Note: Multiple programmers may save changes to different PeopleCode programs associated with the same definition. However, the system displays an error if multiple programmers attempt to save the same PeopleCode program associated with the same definition and PeopleCode event.

Note: With the PeopleCode Editor active, you can select View, Line Numbers to display line numbers to the left of each line in the program, beginning with 001.

This section discusses these programming editors:

  • SQL editor

  • Application packages editor

  • HTML editor

  • Free form style sheet editor

SQL Editor

The SQL editor is a text editor that enables you to construct, modify, and review a SQL statement and save it as a reusable SQL definition. Using the SQL editor, you can add, delete, and change text and you can use the find and replace function. The SQL editor formats the text, but the editor does not validate the SQL syntax.

You can access the SQL editor from these definitions:

  • Record definitions that are based on SQL and dynamic views.

  • PeopleSoft Application Engine actions.

  • PeopleCode editor.

Application Packages Editor

From an Application Package you can access the PeopleCode programs that are associated with the classes of the package. The Application Packages editor and the PeopleCode editor interfaces are similar. You can add, delete, and change text; you can use the find and replace function; and you can validate the syntax. When you save your application package, the code is automatically formatted, just as it is in the PeopleCode editor.

HTML Editor

The HTML editor interface offers some of the same functionality as the other editors. In the HTML editor you can add, delete, and change text; and you can use the find and replace function. While the editor does format certain elements of your code, such as variables, methods, and strings, the editor does not validate the syntax. Because the HTML editor is free form, you can enter any type of text in it because there is no validation of any kind. However because the HTML editor output is used in web pages, typically, you enter only the following markup languages: HTML, JavaScript, CSS, and XML

Free Form Style Sheet Editor

The free form style sheet editor interface enables you to create text-based sub style sheets that enable you to take advantage of Cascading Style Sheets - Level 2 (CSS2), AJAX, and DHTML. In the free form style sheet editor you can add, delete, and change text; and you can use the find and replace function. The editor does not format the text or validate the syntax.