This entry is part of the Maximo Java Development series.
In this little article I'm going to show how to display a dialog box with Yes/No or OK/Cancel buttons and how to capture the user's input to execute some custom logic. For example, you have a Java method attached to a button on the toolbar or to an action menu entry as described in this article and you want to display a warning message asking for confirmation before executing some processing.
This can be easily achieved extending the application AppBean class.
The following snippet is an extension of the WOTRACK app bean that declares a method that displays a custom message box (MyGroup/YesNoDialog) and performs some action if the users clicks the Yes button.
public class CustWorkorderAppBean extends psdi.webclient.beans.workorder.WorkorderAppBean
public int RUNJAVA() throws MXException, RemoteException
WebClientEvent event = clientSession.getCurrentEvent();
int msgRet = event.getMessageReturn();
if (msgRet < 0)
throw new MXApplicationException("MyGroup", "YesNoDialog");
else if (msgRet == WebClientRuntime.MSG_BTNYES)
// Implement your logic here
Refer to this article about how to define a custom Yes/No dialog box.
Refer to this article for attaching a Java method to a button or menu entry.
This article explains how to achieve a similar goal in MBO code.
Labels: advanced, java