Writing your First CronTask for Maximo in Java

Hi, In this turotial I will show you how to write a Crontask for Maximo in Java and schedule it inside Maximo.

Note: If you are looking for crontask in Jython. Please follow this tutorial

A Crontask is  a scheduled job which runs periodically at fixed times, dates, or intervals.

This is a very powerful feature of Maximo which can take customization to a new level. In my experience they can be more versatile than Escalations in Maximo.

Follow the following steps to create a Crontask

1. Write the Crontask in Java

a. In your IDE write the following code. For the simplest of cron tasks we require to extend this SimpleCronTask class.

SimpleCronTask class implements the CronTask interface.A few notable methods of this class are below.

public void init() throws MXException 
public void start()
public void stop()
public void cronAction()

init() is called by the CronTaskManager when the class is instantiated.

start() is called only when the crontask instance is first loaded and active or when it is reloaded and active.

stop() is called when an active crontask instance is interupted by a reload request, or when the contask manager is shutting down

public void cronAction() is the “Core” method of this interface. Here you should implement your logic.

public class FirstCronTask extends SimpleCronTask {

    public void cronAction() {
        // Your custom code here. e.g. A sample code is below.
        MXServer mxs;
        try {
            System.out.println("MyFirstCrontask: STARTING CRONTASK");
            mxs = MXServer.getMXServer();
            UserInfo ui = this.getRunasUserInfo();
            MboSetRemote Mbo = mxs.getMboSet("WORKORDER", ui);
            Mbo.setWhere("WONUM > 1");
            MboRemote row = null;
            int i = 0;
            if (Mbo.count() > 0) {
                while ((row = Mbo.getMbo(i)) != null) {
                    System.out.println("MyFirstCrontask: DESCRIPTION " + row.getString("DESCRIPTION"));
                    System.out.println("MyFirstCrontask: WONUM " + row.getString("WONUM"));
            //End Sample Code
        } catch (Exception e) {


2. Define a New Crontask in Maximo

a. Goto System Configuration -Platform Configuration – Cron Task Setup


b. Create a New Crontask

Click on the new icon to create New Cron Task. Give it any name and give the path for the  classfile we wrote in step 1 for this CronTask.


c. Create and schedule an Instance for the crontask


In the screenshot above, this instance will run every 30 seconds.

3. Check if the cron Task is running fine.

Make sure Admin Mode is off. In the history tab check if it getting populated with the data.


or in the code we configured it print out messages which can be seen in log. Goto logs folder and check if messages are being printed there.



Thanks for reading.






2 thoughts on “Writing your First CronTask for Maximo in Java

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close