Skip to content

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.

  • “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 example ZZ_TRAIN_REQ.COURSE.FieldChange
  • component: COMPONENT.MARKET.Event, for example ZZ_TRAINING_REQ.GBL.SavePreChange
  • component_record: COMPONENT.MARKET.RECORD.Event, for example ZZ_TRAINING_REQ.GBL.ZZ_TRAIN_REQ.RowInit
  • component_record_field: COMPONENT.MARKET.RECORD.FIELD.Event, for example JOB_DATA.GBL.JOB.DEPTID.FieldChange
  • page: PAGE.Event, for example ZZ_TRAIN_REQ.Activate
  • app_class: PACKAGE:SUBPACKAGE:CLASS, for example ZZ_TRAINING:Approval:Router
  • app_engine: PROGRAM.SECTION.STEP, for example ZZ_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.

Input schema
{
"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
}
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
Example: kind record_field, path 'zz_train_req.course.fieldchange'
{
"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:

ZZ_TRAIN_REQ.COURSE.FieldChange
/* 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;

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:

Text of a record field program (Oracle Database)
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 PROGSEQ

It 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:

The program's last change (Oracle Database)
SELECT DISTINCT LASTUPDDTTM, LASTUPDOPRID
FROM PSPCMPROG
WHERE OBJECTID1 = 1 AND OBJECTVALUE1 = :record
AND OBJECTID2 = 2 AND OBJECTVALUE2 = :field
AND OBJECTID3 = 12 AND OBJECTVALUE3 = :event
  • A call returns at most 2,000 lines. When there’s more, nextStartLine says 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 PSPCMPROG but its text is missing from PSPCMTXT, 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 FieldFormula live in FieldFormula programs, which this tool reads like any other record field program.