One of the main features of Maximo is to create workflows to manage the life cycle of the different documents provided by Maximo, such as: Work Orders, Purchase Orders, Service Requests, etc.
Using WorkFlowService class
In case you need to route a workflow with a certain business logic, it would be as follows:
# Route a workflow
from psdi.server import MXServer
# getting the workflow service
workflowService = MXServer.getMXServer().lookup("WORKFLOW")
# starting workflow instance for the current mbo
workflowService.initiateWorkflow("MyWorkflow", mbo)
Using ScriptService class
You can also invoke a Workflow like this:
# Route a workflow
service.invokeWorkflow("MyWorkflow")
Stopping a Workflow Instance
You can stop an active workflow instance using WorkFlowService class and its method stopWorkflow.
# Stop an active workflow instance
from psdi.server import MXServer
# getting the workflow service
workflowService = MXServer.getMXServer().lookup("WORKFLOW")
# getting the active instances for the current mbo
wfinstanceMboSet = workflowService.getActiveInstances(mbo)
# stopping the first active instance for the current mbo
wfinstanceMboSet.moveFirst().stopWorkflow("stopped WF using Script")
If you found my post interesting or useful and just want to say thanks, you can always buy me a coffee.



