在PeopleSoft页面中显示运行中Application Engine进程状态的需求
Alright, let's tackle this problem—you want to show your Application Engine's real-time status directly on the same PeopleSoft page where you launched it, matching the style from your reference (图1). Here's a step-by-step implementation that works well:
First, carve out a dedicated area on your page to show the AE process details. You can use a Group Box to wrap the fields (to match the structured look from your reference) and add these key fields:
- Process Instance ID
- Current Run Status
- Start Timestamp
- End Timestamp
Set this section to be hidden initially—we'll make it visible only after the user clicks the launch button.
Your existing button code submits the AE process, but we need to capture the Process Instance ID (the unique identifier for the running AE) and kick off the status refresh. Here's the modified PeopleCode:
Local ProcessRequest &pr = CreateProcessRequest(); &pr.ProcessName = "YOUR_AE_PROCESS_NAME"; // Replace with your AE name &pr.ProcessType = "Application Engine"; &pr.RunControlID = &RUN_CNTL_ID; // Your run control ID variable &pr.OperatorID = %OperatorId; &pr.RunLocation = %RunLocation; Local integer &ProcessInstance = &pr.Submit(); If &ProcessInstance > 0 Then // Store the process ID in a page field or component variable AE_PRCS_INSTANCE.Value = &ProcessInstance; // Show the status section we created earlier GP_AE_STATUS.Visible = True; // Start the status refresh loop RefreshAEStatus(); End-If;
Create a reusable PeopleCode function RefreshAEStatus() that periodically checks the process status and updates the page. This avoids forcing users to navigate to Process Monitor:
Function RefreshAEStatus() Local integer &ProcessInstance = AE_PRCS_INSTANCE.Value; If &ProcessInstance <= 0 Then Return; End-If; // Use PeopleSoft's official API to get process info (better for permissions) Local ProcessInstanceInfo &piInfo = GetProcessInstanceInfo(&ProcessInstance); If &piInfo <> Null Then // Update page fields with fresh status data AE_STATUS.Value = &piInfo.RunStatusDescr; AE_START_TIME.Value = &piInfo.BeginDateTime; If All(&piInfo.EndDateTime) Then // Process is done—fill in end time and stop refreshing AE_END_TIME.Value = &piInfo.EndDateTime; /* Optional: Add a success/error indicator based on status */ If &piInfo.RunStatus = 9 Then // Success status code AE_STATUS.Style = "PSLEVEL3TEXT_SUCCESS"; ElseIf &piInfo.RunStatus = 3 Then // Error status code AE_STATUS.Style = "PSLEVEL3TEXT_ERROR"; End-If; Return; Else // Process is still running—refresh every 3 seconds WinMessage("", 0, 3000); // Trigger refresh after 3 seconds RefreshAEStatus(); End-If; End-If; End-Function;
Note for Web-based PeopleSoft: If WinMessage doesn't work for your web environment, use an AJAX-based refresh instead. You can set up a hidden timer component or use JavaScript to call RefreshSection on the status area every few seconds.
Tweak the section's appearance to align with your reference:
- Use a Group Box with a clear label like "AE Process Status"
- Apply PeopleSoft's built-in styles (or custom CSS) to highlight statuses: green for success, red for errors, blue for running
- Align field labels and values neatly (use a grid or stacked layout depending on your reference)
- Always use
GetProcessInstanceInfo()instead of queryingPS_PRCSINSTANCEdirectly—it respects PeopleSoft's security permissions. - Add a timeout to the refresh loop (e.g., stop after 30 minutes) to avoid infinite refreshes if the process hangs.
- If your AE runs in the background, you can add a "Stop Refresh" button to let users halt the status checks manually.
内容的提问来源于stack exchange,提问作者Tom Micua

