Thursday, 11 February 2021

Overdue Duration Calculation Between Two Dates (Excluding Weekends) using Automation Scripts | Maximo

We have two dates, the status date: rcareviewdate and Etc date:rcainprgdate. The script below calculates the duration in Hours excluding weekends between these two dates based on attribute status date change. 

When we change the status it will calculate overdue for previous status ETC date and current status change date.

Launch Point Type:     Attribute Launch Point

Attribute:                     CHANGEDATE

  #Imports


from java.util import Date 

from java.text import SimpleDateFormat

from psdi.mbo import MboConstants 

from psdi.server import MXServer

from java.util import Calendar

from psdi.app.common import DateUtility



#Milliseconds Constants

MILLISECONDS_DAY= 86400000 

MILLISECONDS_HOUR = 3600000

MILLISECONDS_MINUTE = 60000 


#Default hours and minutes values

days = 0

hours = 0

minutes = 0 

Tuesday, 2 February 2021

Rest / OSLC API Authentications Native or LDAP (Basic/Form) | Maximo

The most common forms of authentication to use with REST API are:

  • Native - (MaxUser Tables)
  • LDAP - (Directory service authentication)

Update: In Mas Manage, The former methods of utilizing maxauth (native authentication) or basic auth (LDAP) are no longer supported because MAS provides its own OIDC identity provider OOB. So we need to utilize API key and utilize the /maximo/api route. 

Native Authentication
   is configured to manage users' credentials within Maximo MaxUsers tables. Maximo is responsible for authenticating all the incoming REST calls. 

The Below System property tells us the application security is off. Also, the HTTP request header and return are shown below:

System Property

 

mxe.useAppSecurity

0

URL call

 

http://localhost/maximo/oslc/login

Request Headers

 

MAXAUTH

<BASE64encoded user:password>

Response in Return

 

JSESSIONID

As cookie to maintain the same session



NOTE: Postman automatically save these cookies and utilize them for subsequent calls, but it can be handled programmatically. 

LDAP
The Below System property tells us the application security is ON.

System Property

 

mxe.useAppSecurity

1

in LDAP Maximo uses directory authentication and validates users' credentials from the directory configured in WebSphere.

In this case, security settings are defined in WEB.XML file in below mentioned 4 files

  • maximo/application/maximoweb.xml
  • maximo/application/maxrestweb.xml
  • maximo/application/mboweb.xml
  • maximo/application/meaweb.xml
  •     in these files <login-config> section needs to be uncommented to use either FORM or BASIC authentication. 

     

    Monday, 1 February 2021

    Display Attribute Value in Message Tracking as External Message Id | Maximo

    To track or find the messages in the message tracking application is sometimes very difficult. But we can tweak this by extracting and displaying some of the message information in the External Message column in the list view. This way it will be helpful to find the relevant message. 


    For instance: Let's say that we have an inbound message utilized by continues cron on the WORK ORDER object. 

    Message tracking is also enabled, we can see the work order number in the list view by putting this string in the External Message ID configuration as below:




     In the services > Select Action > Message Tracking > enable message tracking and 

    enter below into External Message-Id: 

    operation/integration-object-set/main-MBO/attribute with namespace as in the below example

    Example:

    {http://www.ibm.com/maximo}SyncWORKORDEROS/{http://www.ibm.com/maximo}WORKORDEROSSet/{http://www.ibm.com/maximo}WORKORDER/{http://www.ibm.com/maximo}WONUM