New After Duplicate Script
In IBM Maximo 7.6.1.3 or newer, the AfterDuplicate automation script launch point introduces a powerful way to automate post-duplication actions on work orders. This feature allows for greater control over what happens immediately after a work order is duplicated, reducing manual intervention and improving workflow efficiency.
One common challenge when duplicating work orders is ensuring that task statuses are properly carried over. By default, tasks in the duplicated work order may not retain the desired status, leading to inconsistencies and additional manual work. In this article, we will explore how to leverage a Python automation script with the AfterDuplicate launch point to automatically update task statuses, ensuring a seamless duplication process.
Understanding the Automation Script
This script is executed when a work order duplication occurs, ensuring that any associated tasks inherit the correct status. Below is a breakdown of its key components:
1. Script Metadata
The script is named WORKORDER.AFTERDUPLICATE and is triggered automatically after a work order duplication event.
'''
{
'autoscript': 'WORKORDER.AFTERDUPLICATE',
'description': 'Action perform on afterduplicate action',
'scriptlanguage': 'python',
'loglevel': 'ERROR',
'version': '1.0.0'
}
'''
This metadata defines the script’s purpose, language and logging level.
2. Importing Required Modules
IBM Maximo provides several modules to interact with its database and perform logging. The script imports:
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants
from psdi.server import MXServer
- MXLoggerFactory for logging script execution.
- MboConstants for defining constants used in status changes.
- MXServer for fetching system date and managing MBO operations.
3. Initializing Logging
Logging is essential for debugging and monitoring script execution.
logger = MXLoggerFactory.getLogger('maximo.script.workorderafterduplicate')
logger.debug('Starting Workorder After Duplicate Script')
This ensures that any errors or events during execution are recorded.
4. Checking the Application Context
The script executes only if the duplication process occurs within the QUICKREP application.
if app == "QUICKREP":
This prevents the script from running unnecessarily in unrelated applications.
5. Processing Work Order Tasks
To maintain consistency, the script retrieves and updates the status of related tasks.
# Get the MboSet for the tasks related to this work order
taskSet = dupmbo.getMboSet("WOACTIVITY")
It then checks if the retrieved task set is empty:
if not taskSet.isEmpty():
logger.debug('The TaskSet is not empty')
taskMbo = taskSet.moveFirst()
For each task in the set, the script changes the status to INPRG (In Progress):
while taskMbo:
taskMbo.changeStatus('INPRG', MXServer.getMXServer().getDate(), 'Changed to INPRG by Duplicate Process', MboConstants.NOACCESSCHECK)
taskMbo = taskSet.moveNext()
This ensures that all associated tasks remain active after duplication.
6. Closing the Task Set
Finally, the script closes the task set to free up system resources.
taskSet.close()
logger.debug('Workorder AfterDuplicate Script completed')
Benefits of Automating Task Status Updates
- Reduces Manual Effort: Eliminates the need for manually updating task statuses after work order duplication.
- Ensures Consistency: Prevents discrepancies between parent work orders and associated tasks.
- Improves Efficiency: Streamlines the workflow process by ensuring tasks remain active.
Conclusion
This automation script is a great example of how Maximo’s scripting capabilities can be leveraged to optimize maintenance workflows. By implementing this Python script, organizations can enhance their work order management process, reduce manual intervention, and improve operational efficiency.
If you’re working with IBM Maximo and looking to automate similar processes, consider customizing this script to fit your unique business requirements!
About
A3J Group is a leading solutions and consulting firm based in Tampa, Florida, specializing in Enterprise Asset Management (EAM) with a focus on fully developed Computerized Maintenance Management System (CMMS) solutions like IBM Maximo.
In addition to our suite of proprietary products—including MxMobile, our powerful mobile solution for Maximo—we provide traditional consulting services that help organizations plan, implement, optimize, and support their EAM strategies. Whether clients need hands-on configuration, strategic guidance, or ongoing system support, our team delivers the expertise to drive long-term success.
With over 50 years of combined experience, our specialized team is dedicated to our core mission: to serve as excellent stewards of our clients’ trust and investments, while driving measurable results through tailored, high-impact solutions and intelligent consulting.
Visit us at www.a3jgroup.com. Or drop us a line at info@a3jgroup.com.


