You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

1. Add a Status Display Section to Your Page

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.
2. Update the Button's Click Logic

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;
3. Build the Real-Time Status Refresh Logic

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.

4. Match the Style from 图1

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)
Quick Tips
  • Always use GetProcessInstanceInfo() instead of querying PS_PRCSINSTANCE directly—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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 07:04:52