Sample Action Class

This entry is part of the Maximo Java Development series.

Sometimes you have to implement some complex logic in workflows or escalation and you feel limited by the out-of-the-box Maximo actions. In these cases you can unleash the Java power and code your algorithm in a custom action class.
In order to create a custom action class, you must extend the  psdi.common.action.ActionCustomClass class.

package cust.actions;

import java.rmi.RemoteException;
import psdi.common.action.ActionCustomClass;
import psdi.mbo.MboRemote;
import psdi.util.MXException;

public class SampleAction implements ActionCustomClass
public SampleAction()

public void applyCustomAction(MboRemote mbo, Object[] params)
throws MXException, RemoteException
// Write custom code here

As usual… compile, rebuild EAR and redeploy. For a full example of a custom action class look here.

To call this action from a workflow or escalation you have to register the new Maximo action. Go in System Configuration – Platform Configuration – Actions and create a new action. Choose Custom Class as Type, select the object for which the custom applies and provide the full class name (cust.actions.SampleAction) in the value field. Here is how the new Action should look.

Sample Action Class

11 thoughts on “Sample Action Class

  1. Could you provide some additional details on how you would extend ActionCustomClass to move data from the base object to another object. I would like to have workflow invoke a custom action that copies data from one object to another and I am not sure how to tackle this objective.

  2. In the applyCustomAction you have a reference to the Mbo. Use relationships to navigate MBOs and update data accordingly.
    For example, if you want to set all the description of the child POLINES of a PO do something like this.

    String desc = mbo.getString("DESCRIPTION");
    MboSetRemote polines = mbo.getMboSet("POLINES");
    for(MboRemote poline=polines.moveFirst(); poline!=null; poline=polines.moveNext())
    poline.setValue("DESCRIPTION", desc);

  3. Thanks for the quick Response Bruno, Is there a way to output the contents of the string polines in the systemOut.log? I have done customizations using the integration root logger, but I am not sure how this is done when developing custom actions. Also, POLINES is the name of the relationship that is used to map PO to POLINE correct?

  4. You can use whatever logger you want.
    Yes POLINES is the name of the relationship from PO object to POLINES as defined in the Database Configuration.

  5. hi, can u explain how can we take custom class parameters? there are 2 parameter in this class(mboremote and object). i want to take object parameter. thank you

      1. First param is the mbo being routed through workflow, the second param is an Object array of WFInstance object, WFACtion object and third optional is a String parameter you input in the Action definiton under the “Parameter/attribute” field. WFInstance is how you can get current people having the assignment, WFAction is that current WF Action on which you defined the custom class to execute, and can be used to fetch the node from which the action was executed via the familiar getOwner() call; you can also use WFAction to explore previous nodes, get particular node types, etc etc

        Hope this helped

  6. My applyCustomAction function gets called repeatedly after performing operation in first iteration.
    But continues to get called, Why it is so ? Can you help ?

  7. Could you provide some additional details on how you would extend ActionCustomClass to perform select action method for application.

    e.g. I want to create Investigation from Incident using Action.
    and for this standard Application Action has not supported the action.
    How can I achieve this using custom class in action ?

  8. Bruno, consider adding the following to the main post;

    mbo is the Mbo being routed through WF
    params is an Object[] with 3 elements
    params[0]=String (Parameter/Attribute value in the definition of action invoking this Java class)
    params[1]=WFInstance object of the particular WF for mbo. Good to access active WF Assignments in this moment, and in my particular use case, get username of person who initiated the WFAction
    params[2]=WFAction object of the particular WFAction being run. Previous Node, in particular, is the owner here. From there you can fetch if a user entered a memo when routing WF, or fetch the WFNode.getNodeDetail().getType etc

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top