November 26, 2012

How to reset user's Start Centers

Today I have discovered a nice script called cleanstartcenters.bat that can be used to force the reload of the Start Center for a specific set of users. The usage of this script is documented in this IBM TechNote.
Unfortunately, the script seems have some problems or I'm am too silly to use it :-) so I decided to develop my own set of SQL commands.

First of all you have to identify the set of start centers to be reset. In this example I want to reset all the start centers of the user's belonging to MYGROUP security group. Run this select and check the results.

SELECT * FROM scconfig WHERE groupname='MYGROUP';

Now replace the star (*) character with scconfigid and you will have something like this.

SELECT scconfigid FROM scconfig WHERE groupname='MYGROUP'

Now replace [SCLIST] in the following SQL delete statements with the previous select and execute them.

DELETE FROM rsconfig WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM faconfig WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM inbxconfig WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM kpilconfig WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM kpigconfig WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM actionscfg WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM portletdisplay WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));

If everything is fine you can run the last two deletes.

DELETE FROM layout WHERE layoutid IN (SELECT layoutid FROM layout WHERE scconfigid IN ([SCLIST]));
DELETE FROM scconfig WHERE scconfigid IN ([SCLIST]);

November 22, 2012

Custom Java Class for Roles

This entry is part of the Maximo Java Development series.

This is just an example of a Maximo role defined with a custom Java class. In this example I have defined a role that can be used to send emails (Communication Template) to the workorder's supervisor or to the owner group if the supervisor is not set.

This is the definition of the role.

And this is the Java code.

package cust.psdi.workflow;

import java.rmi.RemoteException;

import psdi.common.role.CustomRoleAdapter;
import psdi.common.role.CustomRoleInterface;
import psdi.common.role.MaxRole;
import psdi.mbo.MboRemote;
import psdi.util.MXApplicationException;
import psdi.util.MXException;

 * Returns the supervisor if set otherwise returns the owner group
public class SupervisorOrOwnerGroup extends CustomRoleAdapter implements CustomRoleInterface
  public MboRemote evaluateCustomRole(MaxRole roleMbo, MboRemote currentMbo)
      throws MXException, RemoteException
    // check if the current MBO is a WorkOrder
    if (currentMbo instanceof
      throw new MXApplicationException("workflow", "WrongObject");

    String sup = currentMbo.getString("SUPERVISOR");
      // if the supervisor is set returns the corresponding person
      MboRemote mbs = currentMbo.getMboSet("SUPERVISOR").getMbo(0);
      return mbs.getMboSet("PERSON").getMbo(0);
    // otherwise returns the corresponding owner group
    return currentMbo.getMboSet("WORKORDERTOPERSONGROUP").getMbo(0);

November 18, 2012

Reading and updating Mbo's attributes

This entry is part of the Maximo Java Development series.

In this post I have explained how to query and fetch MBOs from the database. In this small article I will show how to get and set the attributes of an Mbo.

How to read attributes

To read the attributes of an Mbo you can use teh following getXxxx methods:
  • getBoolean
  • getByte
  • getBytes
  • getDate
  • getDouble
  • getFloat
  • getInt
  • getLong
  • getString

All these methods accept only one argument which is the name of the attribute to be retrieved from the Mbo.
Here is a a small example showing how to retrieve the ASSETNUM and ASSETID of an asset.

String assetnum = asset.getString("ASSETNUM");
int assetid = asset.getInt("ASSETID");

The is also a special technique to retrieve multiple attributes using the getMboValueData method as described in this post.

How to set attributes

To modify the value of a field you can use setValue methods. The setValueNull method can be used to set a null value. Here is a a small example showing how to set the DESCRIPTION and INSTALLDATE of an asset.

asset.setValue("DESCRIPTION", "New description");
asset.setValue("INSTALLDATE", new Date());

All setValue methods have a second version that accepts some flags. The valid flags are defined in the MboConstants class. Here are the most important ones:
  • NOVALIDATION: suppress validation
  • NOACTION: suppress action
  • NOVALIDATION_AND_NOACTION: suppress validation and action
  • NOACCESSCHECK: suppress access control checks

They can be merged with the bitwise OR operator '|'.

asset.setValue("DESCRIPTION", "d1", NOVALIDATION);

November 17, 2012

Quering and fetching MBOs

This entry is part of the Maximo Java Development series.

To query a Maximo table using Java you need to perform the following steps:
  1. Get a reference to the MboSet.
  2. Specify a where clause.
  3. Loop through the MboSet and fetch Mbos.
The following example shows how to retrieve all the assets located in BEDFORD site.

MboSetRemote assetSet = getMboSet("ASSET");
MboRemote asset=null;
for(int i=0; (asset=assetSet.getMbo(i))!=null; i++)

  • The getMboSet method gets a reference the ASSET table.
  • The setWhere method specifies the SQL where clause that must be applied to filter data. If the setWhere is not invoked, the entire table will be fetched.
  • The getMbo method returns a specific element of the MboSet collection. The first invocation of getMbo method automatically fetches data and initialize the MboSet.

November 16, 2012

How to test workflows notifications and emails

Today I want to share with you all a very efficient technique that I use to test email notifications and communication templates in workflows.

The technique is based on a very lightweight dummy SMTP server called smtp4dev that can run on any Windows system. This small application sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected.

I typically install this little app on the same system where Maximo runs but you can chose to install it on another Windows system if you prefer so.
First of all you need to install Microsoft .NET Framework 3.5. You can download it from here.
Now go to the smtp4dev website and download the latest standalone package.
Launch the smtp4dev.exe file and leave it running.

Now open Maximo and edit the system property setting it with the hostname of the system where you have installed smpt4dev. You can set it to localhost if it is installed on Maximo server. Remember to do a 'live refresh' of the system property.

Now you are free to test your workflow and communication templates. Emails will not be delivered to real users but will be forwarded to smtp4app. Every time an email is sent from Maximo, you will see an new row into smtp4dev interface. Here is how it looks like.

If you have problems running the smtp4dev application, try to click on the Options button. If you get an error like this it means that you have not installed the right .NET framework.

Happy email testing to everyone!

November 13, 2012

Maximo 7.5 education sessions

During the second half of 2012 IBM held some great education sessions to assist customers in planning their upgrade to Maximo Asset Management 7.5 and SmartCloud Control Desk 7.5. This series was devoted to the Maximo product suite, add-on's and industry solutions. In each session, a member of the business architecture team delivers a presentation chronicling the incremental enhancements made in the product as well as point out functional changes to existing features.

Note: Password for all sessions is tiv0li (0 is a zero)

Session Topic Playback Presentation
Email, Workflow, Esclations
Migration Manager
Work Management
PMs, Meters, Condition Monitoring
Labor, Person, Craft
Assets and Locations
Material Management
Purchasing and Invoicing
Control Desk
ERP Adapters
Archiving, Monitoring
Life Science, Calibration
Crew Management and Healthcare
Oil and Gas, HSE
Service Provider

IBM Maximo 7.5 STE webpage