Category Archives: Maximo tech tips

Site Specific MBO creation


I had the requirement from a Custom Cron task and I came across this so thought of sharing.

I wanted to add Workorders from my Cron based on the SiteID I was passing as a parameter. So, for each site I have a Cron instance.

What I did was use the setInsertSite, setInsertOrg method on the MboSet class.

So, before calling add I set the relevant SITE and ORG and then called add so it makes sure that only the appropriate sequence or autokey (based on site and org passed on MboSet) is updated.

Can be very useful in some scenarios so thought of sharing.



Run a Birt Report on click of a Button


I was asked this question by one of the visitor on my blog.

How do I run and view a report using bean class?

So, here is the way to execute any report on button click in maximo.

Tis method will be in a bean class and the mxevent value of that button will be runassetreport.

The only part which I think I need to explain in this is:“runtype”, “BIRT”);“appname”, “ASSET”);“reportname”, “asset_detail.rptdesign”);
String pageName = “reportd” + “1010”;

Because this solution talks about a BIRT Report the runtype is BIRT.

Appname is ASSET cause I am running azn asset detail report and this number 1010 is the reportnum from Report table.

As I was just doing a proof of concept I have hardcoded these values but ideally you will be using Report Mbo to get the relevant values.


    public int runassetreport() throws MXException, RemoteException, IOException, ServletException

        ReportAdminServiceRemote reportAdminServiceRemote = (ReportAdminServiceRemote)getMXSession().lookup(“BIRTREPORT”);
        int engineState = reportAdminServiceRemote.getReportEngineState();
        if (engineState == 2)
          this.clientSession.showMessageBox(this.clientSession.getCurrentEvent(), “Reports Overloaded”, getMessage(“reports”, “previewoverload”), 2);

          return 1;
        if (engineState == 1)
          this.clientSession.showMessageBox(this.clientSession.getCurrentEvent(), “Zero Concurrent Run”, this.clientSession.getMaxMessage(“reports”, “zeroConcurrentRun”).getMessage(), 2);

          return 1;
“runtype”, “BIRT”);
“appname”, “ASSET”);
“reportname”, “asset_detail.rptdesign”);
          String pageName = “reportd” + “1010”;
          ControlHandler lookup = RequestHandler.findDialog(this.sessionContext, pageName);
          if (lookup == null)
            String[] params1 = { pageName };
            Utility.showMessageBox(this.sessionContext.getCurrentEvent(), “reports”, “repappnoxml”, params1);
            return 1;
          RequestHandler.showDialog(this.sessionContext, pageName);
        catch (MXException e)
        return 1;


A private util method to get the maxmessages used in the showMessageBox method:

private String getMessage(String msgGrp, String msgKey) throws RemoteException, MXException
        return MXServer.getMXServer().getMaxMessageCache().getMessage(msgGrp, msgKey, this.sessionContext.getUserInfo()).getMessage();






Setting field values to null from interface tables or flat files data sources


In some cases we need to set some values in maximo tables to null using maximo integration framework.


Normally, if you just leave the field blank in the incoming flat file maximo does not update the field with null just because the incoming data has null.


You need to set the incoming null value as ~NULL~ as per the article from IBM below:



Parameters to improve Maximo performance using WebSphere

IBM WebSphere changed parameters in the JDK in IBM JDK1.4.2 SR3. Any WebSphere version using IBM JDK 1.4.2 SR3 or greater is affected.

The change may cause WebSphere to hold onto unused objects for up to ten minutes after they are no longer needed. In high usage environments, this may act as a memory leak so that the application is starved for memory. There is a parameter to control this behavior, ackTimeout.

Some networks may also benefit from a parameter change in the JDK to set the default TCP/IP stack to V4. This can improve network performance by since the default behavior will be for the standard IP V4 and WebSphere will not need to determine the IP type programmatically. This parameter is


Rapid deployment in Websphere environment


I am sure most of us have gone through this.

Consider the development environment or your local machine has WebSphere as the application server.

To rebuild and redeploy on WS environment takes up lot of time and effort.

Ofcourse the easiest and one of the faster ways to deploy is running sync-websphere-maximo.cmd.

What I use is an even faster approach. I just copy paste any files in maximouiweb.war directory in installedApps directory.

In case of business objects, I unzip businessobjects.jar in a folder by the same name “businessobjects.jar”, and then on just copy paste changed class files and restart Websphere.

Using this approach I do not have to redeploy, rebuild any jar or war. Just copy changed classes from Eclipse bin folder.

It saves lot of time and during the development phase you can focus more on coding rather than the tedious task of deployment.


Note: This approach is only recommended for dev environments and that too only for developers.

Using Commtemplate to send out email in custom Java Code

Hi Friends,

Consider the following scenario, you want to send out an email whenever the Owner Group field is changed on a workorder to everyone in the new owner group.

One option is to use MXServer.sendEMail with some hardcoded content or with just a few lines without any kind of formatting.

Better option is to design a Commtemplate and send out a very well formatted email with dynamic content.

There are just a few additional steps in code if you want to do that.

Step 1: Get the CommTemplate Mbo from MXserver

MboSetRemote commSetRemote = getMboSet(“$anylogicalnae”, “COMMTEMPLATE”, ” templateid=’YOUR_TEMPLATE’ “);

Step 2: Get the content:

if(commTemplateRemote.count() > 0)


CommTemplate commRemote = (CommTemplate)commTemplateRemote.getMbo(0);

// mboRemote should be that object whose content wil be replaced in commtemplate. So, if your commtemplate sends out workorder information nand you have used :wonum in your template make sure mboRemote is that object whose information will be resolved/replaced

SqlFormat sqf = new SqlFormat(mboRemote, commRemote.getString(“subject”));

//Set IgnoreUnresolved to true if you want to ignore any errors in commtemplate, errors for stuff like if you have used :wonum and it cannot resolve this attribute.


//Resolve Content method below converts template in to the dynamic content, by resolving I mean instead of :wonum it will put the current records wonum.

String subject = sqf.resolveContent();

//Similarly do it for the message cotent
sqf = new SqlFormat(mboRemote, commRemote.getString(“message”));


String message = sqf.resolveContent();

if (message.length() > 0)


                message = message + “rn”;


//Once you have resolved From, to everything else send out the email

MXServer.sendEMail(sendTO, null, null, sendFrom,subject, message, sendFrom, null, null);


A good combination can be if you also attach a report of the workorder with this email. For that you can read my post on attaching a birt report dynamically in java code.