October 30, 2014

Preventive Maintenance (PM) automatic work order generation

You probably know that Preventive Maintenance module in Maximo allows to schedule periodical maintenance activities in order to keep your assets running efficiently.
In other words you can use the  Preventive Maintenance to schedule the automatic generation of work orders.

Work orders can be generated manually using the 'Generate Work Orders' action in the Preventive Maintenance application. A dialog will be displayed allowing to set the number of days in the future for which the work orders must be created.



The work order generation can be easily automated using the PMWoGenCronTask cron task.
Once the cron task schedule is set you can specify the PM generation rules for each site. Open the Organization application, pick your organization and select the 'PM Options' action from the menu.
The following dialog will be displayed allowing to set the generation option for each site.



Processing all the PM records each day to generate few work orders is not the best option. Almost all the processed records will generate a warning like this:
BMXAA3191E - PM XXXXX is not due yet, or it does not fall within the active season.

A good practice is to restrict as much as possible the PM records processed using the where clause. For example the following where clause selects only the active PM records that will generate a work order in the next month.

status='ACTIVE' and
nextdate - NVL(leadtime,0) - 30 <= SYSDATE

This is important to lower PM generation workload and to avoid a long list of warning messages in the logs.


References

Using Preventive Maintenance (PM) Records to Create Work Orders
Executing PM Wogen Crontask by Site

October 29, 2014

How to display a domain description in an application

Some fields in Maximo are linked to a domain that allows to set its value from a predefined set of values. In some cases however, when the value does not provide enough information, you may wish to also display the description of the domain value that you have chosen.

For example lets consider the STATUS field of the WORKORDER object.
By default Maximo will not show the description associated to the work order status.




Here is how to display the work order status description in the Work Order Tracking application.


Create a relationship to the domain table

Identify the domain name. Open Database Configuration application and look at what domain is set for the specific attribute you are looking for.
For the WORKORDER.STATUS attribute the domain is WOSTATUS.
Now open the WOSTATUS domain and take note of where the description is stored (press Alt+F1).



Now you must define a relationship from the WORKORDER table to the WOSTATUS domain. In our example it is located in SYNONYMDOMAIN table. In other situation the domain table can be ALNDOMAIN or NUMERICDOMAIN.
Open Database Configuration application and define the following relationship for the WORKORDER object:
  • Relationship: WOSTATUSDESC
  • Child Object: SYNONYMDOMAIN 
  • Where Clause: value=:STATUS and domainid='WOSTATUS'

Save and apply configuration changes if needed.


Display the description in the application

Now you must use Application Designer to add a new multipart textbox to your screen to display the domain description close to the field value.

In our example, open the WOTRACK application add a new 'Multipart Textbox' close to the 'Status' field. Set the following properties:
  • Attribute: STATUS
  • Attribute for Part 2: WOSTATUSDESC.DESCRIPTION
  • Input Mode for Part 2: Readonly
  • Copy other properties from the old field if needed



Test the modified application and delete the old field when the the new one is working fine.



October 24, 2014

Use Long Description in a Communication Template

To add the long description to the message of an email sent through a communication template you have to perform a few configuration steps.

The example below is related to WORKORDER object but can be applied to any main object.

First of all you have to create a relationship in Database Configuration between the WORKORDER object and the LONGDESCRIPTION object.
Launch Database Configuration and select the WORKORDER object. Open the Relationship tab and create a relationship with the following properties.
  • Relationship: LONGDESCINFO
  • Child object: LONGDESCRIPTION
  • Where clause: ldkey=:WORKORDERID and ldownertable='WORKORDER' and ldownercol='DESCRIPTION'

Save the relationship. You shouldn't need to activate Admin Mode.

To include the long description in a communication template use the tag :LONGDESCINFO.LDTEXT

Note
If you want to apply this technique to other objects you have to verify which is the LDKEY field to be matched against the source table.
For the TICKET object the LDKEY matches the TICKETUID field so the correct where clause is different.

ldkey=:TICKETUID and ldownertable='TICKET' and ldownercol='DESCRIPTION'

October 6, 2014

Inbound Web Service processing using XSL transformation

The title of this article is quite scaring right?
Let's describe the scenario...

You have an external application that needs to query or update data in Maximo using a Web Service call. In the real world the outbound XML schema of the caller is different from the Maximo inbound interface.
How can you transform the incoming request to the standard Maximo Web Service interface?
This article describes how to use XSLT (EXtensible Stylesheet Language Transformation) to transform the inbound XML structure to a MIF-compliant one.

 This diagram describes what we need to achieve.


NOTE: Before starting complete the Maximo inbound Web Services tutorial to have a basic understanding of inbound Web Services in Maximo and setup the prerequisite configurations for this tutorial.


Setup test tool (SoapUI)

Testing the XSL Transformation in Maximo can be really tedious. You absolutely need a tool to test the XSLT code before putting it into Maximo.
There are many tools around. I suggest to use WmHelp XmlPad for Windows or XTrans.


Sample data

In this tutorial I will focus on a sample inbound request to create or update an asset into Maximo. This is the sample XML.

<Import>
  <Equipment>
    <Equipment>001</Equipment>
    <Description>My desc</Description>
  </Equipment>
</Import>

We want this incoming XML to be transformed to the following MIF WebService call.

<max:SyncMXD-ASSET>
  <max:MXASSETSet>
    <max:ASSET>
      <max:SITEID>BEDFORD</max:SITEID>
      <max:ASSETNUM>001</max:ASSETNUM>
      <max:DESCRIPTION>My desc</max:DESCRIPTION>
    </max:ASSET>
  </max:MXASSETSet>
</max:SyncMXD-ASSET>


Develop XSL Transformation

Now the interesting part...
XSLT is a powerful tool to transform XML structures. I think it is the best technical option to integrate two different systems using Web Services.

I use XMLPad to develop XSLT and test itbut you can use any other tool of your choice.
Now test the following XSL on the sample inbound XML and you will see the magic.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:max="http://www.ibm.com/maximo">

<xsl:output method="xml" encoding="UTF-8" indent="yes"/>

  <xsl:template match="Import">
  <xsl:apply-templates select="Equipment"/>
  </xsl:template>

  <xsl:template match="Equipment">
    <max:SyncMXD-ASSET>
    <max:MXASSETSet>
    <max:ASSET>
      <max:SITEID>BEDFORD</max:SITEID>
      <max:ASSETNUM><xsl:value-of select="Equipment"/></max:ASSETNUM>
      <max:DESCRIPTION><xsl:value-of select="Description"/></max:DESCRIPTION>
    </max:ASSET>
    </max:MXASSETSet>
    </max:SyncMXD-ASSET>
  </xsl:template>

</xsl:stylesheet>


Deploy XSL file

When everything is working fine in your local test tool you are ready to set the XSL transformation in the Web Service configuration.
There are two methods to provide the XSL file to Maximo: on the filesystem or in the maximo.ear file.

The first one is simpler. First of all you have to copy the XSL file on the Maximo server. For example D:\MIF\MXD-ASSETES.xsl.
Open the Web Services application (Go To > Integration > Web Services) and select the MXD-ASSETES service created in the first tutorial. Set the full path of the XSL file in the 'XSL Map' field.

If you have a cluster of application servers it may be convenient to store the XSD file in the EAR file. Copy the XSL file in a subdirectory of the businessobjects folder in the SMP dir. For example D:\IBM\SMP\maximo\applications\maximo\businessobjects\classes\maximodev\xsl.
After having rebuilt and redeployed the maximo.ear file you can reference the XSL file setting maximodev.xsl.MXD-ASSETES in the 'XSL Map' field (without the .xsl file extension).


Test the Web Service

Now launch SoapUI application and create a new project specifying the WSDL link in the 'Initial WSDL' field. Replace the entire content of the sample request with this (setting the correct SITEID).

<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:max="http://www.ibm.com/maximo"> 

  <soapenv:Header/>
  <soapenv:Body>
    <Import>
      <Equipment>
        <Equipment>001</Equipment>
        <Description>My desc</Description>
      </Equipment>
    </Import>
  </soapenv:Body>
</soapenv:Envelope>

You can see that this is just the sample XML wrapped in a SOAP envelope.

References

Using XSLT to transform inbound transactions