How To Change Status Of Work Orders In Maximo Using MBOs?
The process of changing work orders status in Maximo involves writing your code and packaging it in a WAR file and then placing that WAR file in the MAXIMO.ear and redeployment of Maximo Asset Management System on BEA Weblogic Server.
1. Writing code and creating a WAR file
Before writing the code you will need to include library “BusinessObjects.jar” in your project. This jar file is available in Maximo installation folder.
Import required packages
Get instance of MXServer class
MXServer mxServer = MXServer.getMXServer();
Get UserInfo of any authorized Maximo user
UserInfo userInfo = mxServer.getUserInfo(“maxadmin”);
Get WOSet object by passing UserInfo as parameter. If we pass userInfo here of some user lacking required privileges then returned WOSet will be empty.
WOSet woSet = (WOSet)mxServer.getMboSet(“WORKORDER”, userInfo);
Set your where clause for filtering records in woSet
woSet.setUserWhere(“WONUM = ‘1045’ “);
Get first WO object from WOSet
WO wo = (WO)woSet.getMbo(0);
Initialize variable with desired Work Order status
String desiredStatus = “COMP”;
Initialize memo variable which can be used for adding comment like reasons/details of changing status
String memo = “”;
This method changes Word Oder status by updating rows in MAXIMO tables WORKORDER, WOSTATUS etc
wo.changeMaxStatus(desiredStatus, mxServer.getDate(), memo);
Ask Maximo to persist your changes
Close WOSet so that memory resources are freed.
- Deploying your WAR file
To deploy your WAR file you must place it in MAXIMO.ear file. To do that extract MAXIMO.ear file and copy your WAR file in the root directory. You also need to make changes in the application.xml file in MAXIMO.ear located at MAXIMO.ear\META-INF.
Right above <!– List of EJB modules –> line in application.xml insert description of your web module as under:
After making these changes recreate MAXIMO.ear file and redeploy it on BEA Weblogic server.