get_peoplecode
get_peoplecode returns the text of one PeopleCode program. You identify the program with a
dotted path, the usual shorthand for PeopleCode programs, such as JOB.DEPTID.FieldChange, plus
the kind of object it’s attached to. Long programs come back in chunks of lines.
Use it for
Section titled “Use it for”- “Show me the FieldChange code on ZZ_TRAIN_REQ.COURSE.”
- “What does SavePreChange do in the ZZ_TRAINING_REQ component?”
- “Read the ZZ_TRAINING:Approval:Router application class.”
| Argument | Type | Required | Description |
|---|---|---|---|
kind |
string | Yes | What the program is attached to: record_field, component, component_record, component_record_field, page, app_class, or app_engine |
path |
string | Yes | The program’s path, in the format for its kind (see below) |
start_line |
integer | No | The first line to return. Default: 1. |
max_lines |
integer | No | How many lines to return, from 1 to 2,000. Default: 400. |
Each kind of program has its own path format:
record_field:RECORD.FIELD.Event, for exampleZZ_TRAIN_REQ.COURSE.FieldChangecomponent:COMPONENT.MARKET.Event, for exampleZZ_TRAINING_REQ.GBL.SavePreChangecomponent_record:COMPONENT.MARKET.RECORD.Event, for exampleZZ_TRAINING_REQ.GBL.ZZ_TRAIN_REQ.RowInitcomponent_record_field:COMPONENT.MARKET.RECORD.FIELD.Event, for exampleJOB_DATA.GBL.JOB.DEPTID.FieldChangepage:PAGE.Event, for exampleZZ_TRAIN_REQ.Activateapp_class:PACKAGE:SUBPACKAGE:CLASS, for exampleZZ_TRAINING:Approval:Routerapp_engine:PROGRAM.SECTION.STEP, for exampleZZ_TRN_LOAD.MAIN.Step01
Application class paths use colons, as in PeopleCode import statements, and have no event:
OnExecute is the only event an application class has. Application Engine paths name a step; the
server reads the version of the section that applies to your market and database platform, with
the same rules as describe_app_engine.
{ "type": "object", "properties": { "kind": { "enum": [ "record_field", "component", "component_record", "component_record_field", "page", "app_class", "app_engine" ] }, "path": { "type": "string", "minLength": 3, "maxLength": 200, "description": "Program path, for example JOB.DEPTID.FieldChange" }, "start_line": { "type": "integer", "minimum": 1, "default": 1 }, "max_lines": { "type": "integer", "minimum": 1, "maximum": 2000, "default": 400 } }, "required": ["kind", "path"], "additionalProperties": false}Output
Section titled “Output”| Field | Description |
|---|---|
kind, path |
The program, with its path normalized to uppercase names |
text |
The requested lines of code |
startLine, endLine |
The line numbers of the returned text |
totalLines |
The number of lines in the whole program |
nextStartLine |
Where the next chunk starts, or null when this chunk is the last |
lastUpdated, lastUpdatedBy |
When the program last changed, and who changed it |
{ "kind": "record_field", "path": "ZZ_TRAIN_REQ.COURSE.FieldChange", "startLine": 1, "endLine": 7, "totalLines": 7, "nextStartLine": null, "lastUpdated": "2026-02-03T16:20:11", "lastUpdatedBy": "JSMITH", "text": "/* Default the course fee when a course is chosen */\n…"}The text in this example holds this program:
/* Default the course fee when a course is chosen */Local Record &course = CreateRecord(Record.ZZ_COURSE_TBL);
&course.COURSE.Value = ZZ_TRAIN_REQ.COURSE.Value;If &course.SelectByKey() Then ZZ_TRAIN_REQ.FEE_AMT.Value = &course.FEE_AMT.Value;End-If;How it works
Section titled “How it works”The tool turns the path into the program’s key in the PeopleCode tables, using these
OBJECTID key paths:
| Kind | OBJECTID key path |
|---|---|
record_field |
1, 2, 12 |
component |
10, 39, 12 |
component_record |
10, 39, 1, 12 |
component_record_field |
10, 39, 1, 2, 12 |
page |
9, 12 |
app_class |
104, then the class path (105 to 107), then 12 |
app_engine |
66, 77, 39, 20, 21, 78, 12 |
It reads the text from PSPCMTXT, joins the program’s chunks in PROGSEQ order, and splits the
result into lines:
SELECT PROGSEQ, PCTEXT FROM PSPCMTXT WHERE OBJECTID1 = 1 AND OBJECTVALUE1 = :record AND OBJECTID2 = 2 AND OBJECTVALUE2 = :field AND OBJECTID3 = 12 AND OBJECTVALUE3 = :event ORDER BY PROGSEQIt also checks PSPCMPROG, where PeopleTools keeps the program itself, for when the program last
changed and who changed it. That check is also how the tool tells a program that doesn’t exist
from one whose text is missing from PSPCMTXT:
SELECT DISTINCT LASTUPDDTTM, LASTUPDOPRID FROM PSPCMPROG WHERE OBJECTID1 = 1 AND OBJECTVALUE1 = :record AND OBJECTID2 = 2 AND OBJECTVALUE2 = :field AND OBJECTID3 = 12 AND OBJECTVALUE3 = :eventLimits and errors
Section titled “Limits and errors”- A call returns at most 2,000 lines. When there’s more,
nextStartLinesays where the next chunk starts. - When the program doesn’t exist, the error lists the programs that do exist at that level, for example: “ZZ_TRAIN_REQ.COURSE has no FieldEdit program. It has: FieldChange, RowInit.”
- When the program exists in
PSPCMPROGbut its text is missing fromPSPCMTXT, the error says so and suggests opening the program in Application Designer, instead of returning nothing. - The tool returns code as stored, comments included. It doesn’t follow calls to other programs,
but the LLM can read those with more calls. Functions declared with
Declare Function … PeopleCode RECORD.FIELD FieldFormulalive inFieldFormulaprograms, which this tool reads like any other record field program.
Related tools
Section titled “Related tools”describe_componentlists the programs in a component, with their paths.search_codefinds programs by their content.
