Hey Theo,
I did a quick check, and this method works for me. Here's a step-by-step on how to generate a work order from a PM using an automation script on the MXAPIPM object structure.
1. Create an Automation Script for Object Structure MXAPIPM
Sample Script:
from psdi.server import MXServer
pmnum = request.getQueryParam("pmnum")
siteid = request.getQueryParam("siteid")
if pmnum is not None and siteid is not None:
PMMboSet = MXServer.getMXServer().getMboSet("PM", request.getUserInfo())
PMMboSet.setWhere("pmnum='" + pmnum + "' and siteid='" + siteid + "'")
PMMboSet.reset()
if PMMboSet is not None:
PMMbo = PMMboSet.getMbo(0)
if PMMbo is not None:
PMMbo.generateWork(0, 0)
PMMboSet.clear()
PMMboSet.close()
2. Configure the Action in the Object Structure
-
Go to the Object Structures application and open the record for MXAPIPM.
-
Under More Actions > Action Definition, create a new action:
-
Action Name: GENERATEWORKORDER
-
Implementation Type: Script
-
Script Name: Select the script you created in Step 1
3. Test via REST API (Postman Example)
PUT https://<hostname>/maximo/api/os/mxapipm?apikey=<APIKEY>&pmnum=1008&siteid=BEDFORD&action=GENERATEWORKORDER
Request Body: (None - empty body)
Hope this helps!
------------------------------
Vijayalakshmi Mane
Technical Consultant
Bentley Systems Netherlands B.V.
sHertogenbosch, The Netherlands
------------------------------
Original Message:
Sent: Mon July 14, 2025 01:22 PM
From: Theo Pozzy
Subject: How to generate work order from PM using REST API
I need to create a Maximo work order from a Preventive Maintenance (PM) record using the REST API. I am using the built-in MXPM object structure. My understanding is that you need to use "_action=generateWorkorder" to invoke the action to generate the work order. When I do that, I get a 204 response, but no work order gets created. Are there other parameters or headers needed to get this to work?