求助:Maximo 7.6 PUBLISHED Channel集成自动化脚本实现工单字段置1
Maximo 7.6 Published Channel Automation Script: Update Linked WORKORDER Field
Got it, let's walk through how to make this work—you want an automation script that triggers when a WOACTIVITY record goes through a Published Channel, then updates a specific field on its parent WORKORDER to 1. Here's a step-by-step approach with a working example:
Core Approach
First, let’s align on the key pieces you need:
- The Published Channel must be configured for the WOACTIVITY object, with the trigger set to
PUBLISHED(this fires when the record is sent out via the channel). - Your script will need to:
- Grab the parent WORKORDER's
WONUMfrom the triggering WOACTIVITY record. - Retrieve the corresponding WORKORDER MBO (Maximo Business Object).
- Update your target field to 1, then save the changes.
- Grab the parent WORKORDER's
Example Python Automation Script
This script assumes your target field on WORKORDER is an integer field (e.g., MYFLAG—replace this with your actual field name):
from psdi.mbo import MboConstants # Get the current WOACTIVITY record that triggered the script wo_activity = mbo # Get the parent work order number from WOACTIVITY wo_num = wo_activity.getString("WONUM") # If we have a valid WONUM, retrieve the WORKORDER MBO if wo_num: try: # Get the WORKORDER set using the system user context wo_set = mbo.getMboSet("WORKORDER") # Filter to find the specific work order wo_set.setWhere("WONUM = '" + wo_num + "'") wo_set.reset() # Get the first (and only) matching WORKORDER record work_order = wo_set.getMbo(0) if work_order: # Update the target field to 1 (adjust field name to match yours) work_order.setValue("MYFLAG", 1, MboConstants.NOACCESSCHECK) # Save the changes work_order.save() # Optional: Log a success message (check Maximo logs for this) service.logInfo(f"Updated WORKORDER {wo_num}: MYFLAG set to 1") else: service.logError(f"WORKORDER {wo_num} not found for WOACTIVITY {wo_activity.getString('ACTIVITYID')}") except Exception as e: service.logError(f"Error updating WORKORDER for WOACTIVITY {wo_activity.getString('ACTIVITYID')}: {str(e)}") else: service.logError("WOACTIVITY has no parent WONUM—cannot update WORKORDER")
Critical Configuration Steps
Link the Script to Your Published Channel:
- Go to Integration > Published Channels and open your WOACTIVITY channel.
- Navigate to the Automation Script tab.
- Click Add, select your script, and set the Trigger Point to
PUBLISHED. - Save the channel configuration.
Permissions & Validation:
- Ensure the user running the script (usually the Maximo integration user) has UPDATE access to the WORKORDER object and your target field.
- Verify your target field on WORKORDER is an integer type (if it's a character field, change
1to"1"in the script). - If your WORKORDER records are in a non-editable status (e.g., CLOSED), you may need to adjust the script to handle that (or update status permissions if required).
Troubleshooting Tips
- Check Maximo's System Logs (Go to System Configuration > Platform Configuration > System Logs) for error messages if the script isn't firing.
- Test the script manually first using the Automation Scripts application's Test feature—pass a sample WOACTIVITY MBO to verify it finds and updates the WORKORDER correctly.
- Ensure the Published Channel is active and configured to send records (check the Status and End Point settings).
内容的提问来源于stack exchange,提问作者matta0990
相关产品推荐
相关产品推荐

