Showing posts with label Customization. Show all posts
Showing posts with label Customization. Show all posts

Tuesday, 20 April 2021

Maximo Date Format Conversion Using Automation Scripts

We can convert the normal date format to Maximo date format (yyyy-mm-ddThh:mm:ss.ffffff) using Automation Script.

Script Language: javascript

load("nashorn:mozilla_compat.js");
importPackage(Packages.java.text);

erData.breakData();
var actualDate = erData.getCurrentData("ACTUALDATE");
print("INPUT : " +actualDate);

var inputFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");
var outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
var dateParse = inputFormat.parse(actualDate);
var maximoDate = (outputFormat.format(dateParse)).replace(" ", "T") +"+05:30";
print("OUTPUT : " +maximoDate);

erData.setCurrentData("ACTUALDATE", maximoDate);

Output:

INPUT : 4/20/2021 03:30:52 PM
OUTPUT : 2021-04-20T15:30:52+08:00

Tuesday, 13 August 2019

Populating Condition Codes By Just Clicking Condition Code Check Box in Maximo

Recently we had a requirement to add the condition Code on clicking the Condition Code Check box in Item application.

Below is the Code that was written in JavaScript,
Launch Point Type: Attribute Launch Point
Object: Item
Attribute Name: CONDITIONENABLED

importPackage(Packages.psdi.mbo);

var conditioncode  = mbo.getBoolean("CONDITIONENABLED");
var itemconditionSet = mbo.getMboSet("ITEMCONDITION");

if(conditioncode)
{
  for(i=0;i<3;i++)
  {
    var itemcondition = itemconditionSet.addAtEnd();
    if(i == 0)
    {
      itemcondition.setValue("CONDITIONCODE","A");
    }
    else if(i == 1)
    {
      itemcondition.setValue("CONDITIONCODE","B");
    }
    else if(i == 2)
    {
      itemcondition.setValue("CONDITIONCODE","C");
    }
  }
}



Wednesday, 24 July 2019

Maximo Automation Script setting values while Initializing

There are times where we need to set the value when the object is invoked rather that setting the values during the save method. This can be achieved in Maximo automation scripts.

Step 1: Create an Object Launch Point with JavaScript.
Step 2: Make sure to check the Initialize? check box is checked. And all other check box are unchecked.
Step 3: Below is the sample code for setting the "Inspection Required" and "Adding Spare Parts" check box to always be checked when the item is created.

importPackage(Packages.psdi.mbo);
if(mbo.getString("ITEMSETID")=="ITEMSET1"){
    if(mbo.toBeAdded()==true){
        mbo.setValue("INSPECTIONREQUIRED", 1);
        mbo.setValue("SPAREPARTAUTOADD", 1);
    }
}

Wednesday, 3 April 2019

Integration Flow for Maximo Inbound Using Enterprise Service

Maximo integration framework has always intrigued me. There are different layers at which the MIF works in Maximo. So a college and me had done an experiment in Maximo inbound integration framework using enterprise service. We extended all the base Maximo integration class and added system.out messages to each of the extended methods.

Below is the flow of class that is called when data has been inbound. The experiment was done on Maximo 7.1 version.

Below is the color code for each of the applications.


Below is the flow of diagram from request XML up to Maximo business object validation.

Then response is followed from Maximo to the response XML.


Wednesday, 11 April 2018

Setting Current Date in XSL for Maximo Integration

During Maximo integration there is need to transform XML from Maximo XML format to External System(eg Oracle) XML format. There we can use the XSL mapping in Maximo. Maximo converts the XML to destination XML format using XSL language and vice versa. During that time, if there is need to set the current date in the XSL format see the below code spinet.

<xsl:stylesheet version="1.0"  
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
xmlns:max="http://www.ibm.com/maximo"  
xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java">
 <xsl:template match="/">
  <max:SyncRFQSResponse>
   <max:RFQSet>
    <max:RFQ action="AddChange">
      <xsl:for-each select="max:RFQSyncResponse/max:RFQSet/max:RFQ">
       <max:RFQNUM>
         <xsl:value-of select="max:RFQNUM" />
       </max:RFQNUM>
       <max:SITEID>
         <xsl:value-of select="max:SITEID" />
       </max:SITEID>
       <max:TEST_DATE>
         <xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy-MM-dd HH:mm:ss'), java:java.util.Date.new())" />
       </max:TEST_DATE>
      </xsl:for-each>
    </max:RFQ>
   </max:RFQSSet>
  </max:SyncRFQResponse>
 </xsl:template>
</xsl:stylesheet>

Thursday, 15 June 2017

Adding Bulletin Board Message ID field on Maximo Start Center

We can't add Bulletin Board Message ID field through maximo configuration level.

So we need to modify 3 base class files.

\maximo\applications\maximo\maximouiweb\webmodule\WEB-INF\classes\psdi\webclient\controls
BulletinBoard.class

\maximo\applications\maximo\businessobjects\classes\psdi\app\bulletinboard
BulletinBoardCache.class
BBSet.class

Moreover we can't extend these classes since we need to modify some private methods. So we have to do our changes in base class itself.


1) Add below line in BulletinBoard class

columnHeading.put("bulletinboardid", bbset.getMboValueInfoStatic("bulletinboardid").getTitle());