September 19, 2011

Automatically display table results when application is displayed

Sometimes you may develop a custom Maximo application that shows a list of entries in a table. If the application is used frequently and the result set to show is not huge, it could be useful to automatically display the table content without the need to hit enter or click on the search icon.
Here is a little tip that may solve this little usability issue.
Open the application in the Application Designer and select main table, find the 'Start Empty' checkbox and uncheck it. If it is already unchecked you may need to first tick and then untick it.

That's all.

Application default search filters

I know that there is an official IBM Technote that already provides a solution to apply a default filter in a given Maximo application.
However this solution has some drawbacks. The main problem I see is that using this technique the field filters are not displayed in the application so it could be tricky for the user to understand what's happening.

I have found a better solution customizing the application's Java bean class (AppBean) specifying the QBE (Query By Example) parameters to the application DataBean in the initializeApp() method.
Here is a practical example about how to do this on the WOTRACK application.

To determine which Java bean handles the application, open Application Designer and select the application, from the Action menu choose 'Toggle Show All Controls' and display the properties of the 'presentation' section. The 'App Bean Class' defines the Java class that you need to customize. For the WOTRACK application it should be psdi.webclient.beans.workorder.WorkorderAppBean.
You should extend this class and override the initializeApp() method adding your filters as QBEs to the application's DataBean.
Here is how the custom class should look like.

public class CustomWorkorderAppBean extends WorkorderAppBean
  public void initializeApp() throws MXException, RemoteException
    DataBean resultsBean =;
    resultsBean.setQbe("siteid", "XXX");
    resultsBean.setQbe("someotherfield", "1234");

Put the custom AppBean class file in the Maximo tree, rebuild and redeploy the EAR file. Don't forget to change the App Bean Class property setting your own custom class.

September 1, 2011

How to create a custom message and display it in a Maximo application

This entry is part of the Maximo Java Development series.

A typical need during Maximo application customization is the ability to display a message on the GUI.

The first step is to define the custom message. Open the Database Configuration application and select Messages for the Action menu. Create a new entry filling the required info:
  • Message Group: Messages can be categorized in groups. I typically put here the name of the customer that I'm working on. This allows to quickly list all the custom entries.
  • Message Key: Unique ID of the message. This field together with the MSGGROUP uniquely identifies the message. I typically use a short descriptive name of the message like 'InfoMsg' or 'ErrorMsg'.
  • Display Method: Can be 'MSGBOX' or 'STATUS'. The 'MSGBOX' display a standard popup window displaying the message and a set of customizable buttons. The 'STATUS' displays the text above the tool bar and does not require user intervention.
  • Message ID: Unique ID of the message. The typical format of custom messages is BMX[CC][NNNN][T] where [CC] is a two letters code that identifies your customization, [NNNN] is a four digits number and [T] is the type of message and can be E (Error), W (warning) or I (Info). Maximo suggest to use [CC]='ZZ' for custom messages. For example I have started my custom enumeration with code BMXZZ1001I.
  • Value: Text that will be displayed. Use {N} tags for parameters to be replaced at runtime (see example hereafter). Use \n to insert a newline.
Here is a screenshot of the new message.

Now that you have defined your message in the database it's time to show it.
The technique to display the message is different whether you are in an AppBean or in a Mbo class.

If you are in a custom application bean class (extending AppBean) those two Java lines will bring up the custom message box.

String params[] ={"Hi there!"};
  clientSession.getCurrentEvent(), "MyGroup", "HelloMsg", params);

As you can see the {0} tag in the message will be replaced with the string 'Bruno' defined in the params array. Obviously it is possible to define multiple tags.

It is also possible to display this message box when an exception is thrown. For example the following two rows will display the same message but will also log a stacktrace in the system logs.

String params[] ={"Hi there!"};
throw new MXApplicationException("MyGroup", "HelloMsg", params);

If you are in an Mbo or MboSet (businessobject project) you can 'attach' the message to the MboSet with the MboSet.addWarning(MXException e) method.

String params[] ={"Hi there!"};
this.addWarning(new MXApplicationException("MyGroup", "HelloMsg", params));

Alternatively it is possible to throw an MXApplicationException like this.

String[] params = {"Hi there!"};
throw new MXApplicationException("MyGroup", "HelloMsg", params);