Showing posts with label Maximo. Show all posts
Showing posts with label Maximo. Show all posts

Saturday, 28 June 2025

Conditionally Hide the Table Columns in the List tab of an application in Maximo

The objective is to hide a table column (in our example: "Loop Location" field in Assets Application) from the list tab.



Steps:

1. Navigate to the application designer, open up the record for Asset Application.

2. Click on the "Add/Modify Signature Options" from the Select Action Menu.

3. Click on "New Row" in the dialog box that appears and create a new entry. In our example, I have created C_HIDE.


4. Click on "OK" button and close the dialog box.

5. Click on the field that you intend to conditionally display / hide and open up the properties. In our example, we are opening the properties of "Loop Location" field.


6. Click on the "Advanced" tab on the properties window. 
7. Click on the lookup icon against the "Signature Option" and select the SigOption that was created in Step 3 (C_HIDE). Note: Please ensure you give the "SigOption Data Source ID" value as "MAINRECORD", else the conditional display will not work.




8. Click on the Save button to save the presentation XML.
9. Navigate to Administration -> Conditional Expression Manager, create a new condition. In our example, we have created a condition (C_HIDE). Save the record.
10. Navigate back to the Application Designer and open up the ASSET presentation XML.
11. Open up the properties window for "Loop Location" field and click on the Advanced Tab in the properties dialog box.
12. Click on the "Configure Conditional Properties" button.
13. Click on New Row under the "Security Groups" table and select EVERYONE
14. Click on New Row under the "Conditions for Security Group.." and select the condition that we created in Step 9 (C_HIDE).
15. Enter the property details as below:



16. Grant access to the newly created Signature Option under EVERYONE security group. If the group selected is different in Step 13, grant access to that specific group.
17. Log off and Login again.
18. Open the Asset application and check.




Wednesday, 5 March 2025

Display Length in Internal help Field

Maximo has the ability to display internal help about the field by pressing ATL + F1 or ALT + i. But sometime, I would like to know the length of the field with the Object, Attribute and remarks field. This can be achieved by making some changes in the jsp.


Navigate to the below location.

<SMP>\maximo\applications\maximo\maximouiweb\webmodule\webclient\components\fieldhelp.jsp


Below is the change you need to make in the fieldhelp.jsp. Make sure to take back up of the fieldhelp.jsp


String helpRemarks = fhComponent.getProperty("remarks")+".{"+fhComponent.getProperty("length")+"}";


After making the change, you need to build and deploy.





Friday, 2 September 2022

Maximo Script to Remove HTML Tags Using Regular Expression

 There are times when you need to send long description to external system. But the problem occurs when the Long Description is rich text enabled and contains html tags. Below script uses regular expression to remove the HTML tags.

print ("***********Start of the Script************")
from java.util.regex import Pattern
item_long = mbo.getString("DESCRIPTION_LONGDESCRIPTION")
print (item_long)
match_v1 = Pattern.compile('\\<.*?\\>').matcher(item_long).replaceAll('')
print (match_v1)
print ("************End of the Script**************")

Result

**********Start of the Script************
<div>dasdasd</div><div>sdasd </div><div>asdasd </div><div>asdasdasd </div><div>sdasdas <br /></div><!-- RICH TEXT -->
dasdasdsdasd asdasd asdasdasd sdasdas 
************End of the Script**************

Thursday, 30 June 2022

Maximo Attachment File Size

 Below is the script to calculate the Attachment size in Maximo. The File class is used to get the File details and Length() method is used to capture the size details.

from java.io import File 

path = mbo.getString("DOCLINKS.DOCINFO.URLNAME")
print("The Path Value:",path)
if (path):
	file =  File(path)
	print("The Size of the File in Bytes",file.length())
	print("The Size of the File in MB",file.length()/1024)
	print("The Size of the File in GB",file.length()/(1024 * 1024))
Below is the output captured in the system logs.
[6/30/22 8:01:53:951 EDT] 000000e2 SystemOut     O 30 Jun 2022 08:01:53:951 [INFO] [MXServer] [] ('The Path Value:', u'c:\\DOCLINKS\\ATTACHMENTS\\Maximo-access-via-Published-Service-in-your-local-laptop-browser.docx')
('The Size of the File in Bytes', 543667L)
('The Size of the File in MB', 530L)
('The Size of the File in GB', 0L)

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

Friday, 31 January 2020

Calling Automation Script from List Tab

There are times where we have a list of filtered value and we would like to perform some action on that filtered data. The best place to filter data is the List tab of the application. But when I have the filtered list, how can we call the logic to be performed on the data.

Step 1: Create an Action Automation Script.
Step 2: Make sure the action has been created
Step 3: Create a Signature Option with the same name as Action Name
Step 4: Make sure the "This is an action that must be invoked by user in the UI" option is checked in the Signature option
Step 5: Attach the signature option in the List tab.
Step 6: Make sure the mxevent and signature option are correctly mapped to button field.

Now the question comes where to attach the button group in the List tab


<table datasrc="results_showlist" id="results_showlist" inputmode="readonly" label="Work Orders" mboname="WORKORDER" selectmode="multiple">
<buttongroup id="1580274294655">
<pushbutton id="1580274294659" label="button 3" mxevent="C_WO" sigoption="C_WO" value="C_WO"/>
</buttongroup>
<tablebody displayrowsperpage="20" filterable="true" filterexpanded="true" id="results_showlist_tablebody">

Sample Action Automation Script.
print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
print(mbo.getThisMboSet().count())
print("$%%%%%%%%%%%%%%#$@#$@#$@#$@#$@#$@#$@#$@#$@&%^&$%^&$%^&$^&$&")

The total number of work order that was filtered in the List tab was 30.


Log for the automation script is given in the below screen shot.



Now we have the mboset for work order. Using while or for we can loop through the mbo in action automation script.





Thursday, 24 October 2019

Result set is showing Current Date when the actual value is null


After Upgrading Maximo from 7.1 to 7.6.1.1 we had an issue with Maximo Result set, Empty Date fields are filled up with the current Date.
Below is the fix applied to resolve it.

Find resultsetportlet.jsp file

#WebSphere_Root/webclient/components/resultsetportlet.jsp

Search for "type==MXFormat.DATE" and change the if clause to below,

if ((type==MXFormat.DATE || type==MXFormat.DATETIME ) && finalData !=null && finalData.trim().length()>0)
Now you can see that Empty Date fields showing blank in Result Set

Friday, 9 August 2019

Signature Option Name to be displayed in Security Groups

In Maximo there is lot if Use for Sig options for hiding, making field required and many other purpose. But giving grant access in Security Groups is one of the toughest job. We create the sig option but we have to grant access to the sig option based on the description that was given in the application designer.

So to make things easy, we can also display the sig option name and the description together in Security Groups.

To make the sig option name to be displayed, navigate to the application designer application. Open the Security Groups (SECURGROUP) application.


Export the applicationid into a xml file. Find for the id appls_sigmain_table_tablebody_1a and appls_sigo_table_tablebody_1a. Include the the below tags

 <tablecol dataattribute="optionname" id="1565072808615"/> and 
 <tablecol dataattribute="optionname" id="1565072598311"/>

The final XML should look something like this,

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, 24 April 2019

Launch in Context in Maximo

In Maximo we came across a requirement, where we need to navigate from one maximo application to maximo  another application(without using the detail menu). For example, we need to navigate from asset to work order through click on button and navigation should occur based on the Asset current value. So when the control navigates from asset to Work order, all the work order should be displayed based on the asset. Below is the approach we have followed using Launch in Context. The example we have taken is navigation from Location to Work Order application based on the Current location.


1) Go to --> System Configuration --> Platform Configuration --> Launch in Context application and Create new launch entry.


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.


Tuesday, 2 April 2019

Comparing Dates in DB2 in Maximo

In escalation there are times when you need to perform action after 30 days or 60 days. Thats we need to set condition from sysdate plus 60 or 30 days.

Below is one such methodology to check the dates in escalation.

VARCHAR_FORMAT (enddate, 'YYYY-MM-DD') = VARCHAR_FORMAT(sysdate + 60 days, 'YYYY-MM-DD')

Table Type Presentation in Communication Template

There are instance where we would send mail through communication template. It is important to make sure that the information in the mail is more precise and conveys all details that are necessary. I feel that giving data in tabular format achieves the purpose. So lets see how to send data in tabular format in communication template in Maximo 7.6.

Click on Go To--> System Configuration --> Platform configuration --> Communication Templates.

Then click on the "View HTML Source " icon. As show in the screen shot below.


Enter the following HTML codes in the code snippet field.

Tuesday, 17 April 2018

Importing Item Assembly Structure through Application Import in Item Application


Step 1: Create an Object Structure
Parent : ITEM
Child : ITEMSTRUCT
Relationship : CHILDRENITEMSTRUCT




Step 2: Make sure to change the Alias of ITEMSTRUCT.ITEMID to C_ITEMID and check the support flat file Structure check box.

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>

Tuesday, 10 April 2018

Python - setting Date and Time using automation Scripts

The python version used Maximo automation scripts is 2.5.2. So the normal DateTime function in Python cannot be used in Maximo. The DateTime function is used in Python 3.x and above. As an alternative, we can use the gmtime and strftime packages.

from time import gmtime
from time import strftime
nowTime = strftime("%Y-%m-%dT%H:%M:%S", gmtime())
print(nowTime)
mbo.setValue("TARGSTARTDATE", nowTime)
print("TARGSTARTDATE-->" + mbo.getString("TARGSTARTDATE"))


Monday, 9 April 2018

Planning Service Items in Work Order Plans


This article will provide you an idea about planning service items from Job Plans to Work Orders.

Step 1: Go to Service Item application.

If you have already purchased this service item, then the vendor details and Last Price will be automatically updated in Vendors section based on last Purchase Order.

If you haven’t purchased this service item earlier, then the cost and vendor details will not be available here. You can also enter those details here directly.



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());