Monday, 27 January 2020

A Custom Solution to Get Survey from User when SR is Resolved | IBM Maximo

This summary is not available. Please click here to view the post.

PMSTATUS table to make history of PM records | Maximo

Maximo doesn't support us to have a history of status changes for Preventive Maintenance applications like XXSTATUS table is available for almost all applications.

We decided to have a history table for PM records also so that we know that who and when actually this record was modified.


1. in database configuration create a new object:

Attribute Type Length
CHANGEBY UPPER 30
CHANGEDATE DATETIME 10
DESCRIPTION ALN 50
DESCRIPTION_LONGDESCRIPTION LONGALN 32000
HASLD YORN 1
MEMO ALN 50
ORGID UPPER 8
PMNUM UPPER 20
PMSTATUSID BIGINT 19
SITEID UPPER 8
STATUS UPPER 20


Wednesday, 22 January 2020

How to Read XML using PHP

Let us start with a simple example, for that we need one simple XML file which might be returned in the response of any SOAP or REST.

1. create an XML file, let say we have this file with the name person.xml

<?xml version="1.0" encoding="utf-8"?>
<persons>
        <person id = "101">
            <name>Abdul Qadeer</name>
            <position>CEO</position>
        </person>
        <person id = "102">
            <name>Umar Adil</name>
            <position>CTO</position>
        </person>
</persons>

2. let's create another index.php file to read person.XML file

Tuesday, 21 January 2020

Usage of MboValueAdapter in Maximo Scripts | Maximo

short version to get the PreviousValue which can only be get via the MboValueAdapter
pstatus= mbo.getMboValue("status").getPreviousValue().asString()

Example a script to get previous status and current status to display message.

pstatus= mbo.getMboValue("status").getPreviousValue().asString()
if mbo.getString("status") == 'COMP' and pstatus == 'WASSET':
   if mbo.getInt("item.rotating") ==  1:
       warngroup = "assrecmsg"
       warnkey = "assrecmsg"


Thanks

Create SR from Conduct an Inspection Module

Conduct and inspection is a new work center in Maximo 7609. The user can conduct inspection base on Asset, Location and Work orders.

One of our requirements is to have an SR again if inspection Fails., below is the solution using automation script.



1) Create Automation Script

In automation Script, we have to select create  SCRIPT Launch POINT
Use the pre-defined structure of the script name OSACTION.MXAPIINSPRESULT.CREATEINSPSR
You can change the CRATEINSPR in the above name  OSACTION.MXAPIINSPRESULT will remain the same.

Use Below Script to Create SR, this script will create SR when the user selects Yes in the inspection form that He/She wants to create SR.


Maximo DocInfo Inbound Processing | IBM Maximo

Create Maximo automation script for inbound document transaction from external system.

--create script for integration
--select enterprise service
--select service name
--SYNC.NPP_DOCINFO.EXTEXIT.IN

from com.ibm.tivoli.maximo.util.mbo import IterableMboSet
from java.math import BigDecimal


from java.io import File
from java.rmi import RemoteException
from psdi.mbo import *
from psdi.util import MXException
from psdi.app.doclink import Docinfo
from psdi.app.doclink import DocinfoSet
from psdi.app.doclink import DocinfoSetRemote
from psdi.app.doclink import DoclinksSetRemote
from java.lang import SecurityException
import sys


erData.breakData()

docinfoid = erData.getCurrentData("DOCINFOID")
dociset = MXServer.getMXServer().getMboSet("DOCINFO",MXServer.getMXServer().getUserInfo('MAXADMIN'))
dociset.setWhere("docinfoid="+str(docinfoid))
dociset.reset()
contentuid = dociset.moveFirst().getString("CONTENTUID")

erData.setCurrentData("CONTENTUID",contentuid)


# Code to delete the file from server
URLTYPE = dociset.moveFirst().getString("URLTYPE");
if (URLTYPE=='FILE'):
    URLNAME = dociset.moveFirst().getString("URLNAME");
    print('**** deletefilefromserver... ')
    deletefile = File(URLNAME)
    if (deletefile.exists()):
        print('**** Deleting file... '+URLNAME)
        deletefile.delete()
        print('**** File Deleted... '+URLNAME)



Item Inspection with Maximo Inpsection Form | Maximo

The new version of Maximo Inspection is based on Work Center, which is built on google polymer.
We create Inspection form and perform Adhoc Inspection for either Asset or Location.

2nd Option is to attach inspection form with Route, Job plan or directly with Work order.

What if we want to inspect something else? let say critical item inspection, can we use inspection module with this.
the answer was NO.

But with this little trick we can use this functionality with almost any application:

1. Create a new application, attach inspection form and result form with it.
2. create a new record, put item number, start the inspection.

below is the step by step instructions to create this.

1. Database Configuration:
create a new object let say (CSPINSPECTION) : add INSPFORMNUM as an addition to your required attributes.

Saturday, 18 January 2020

Express.js in 5 mintues | Node.js

npm install express

my fist HelloWorld application.

var express=require('express');    //use the express module
var app=express();     // create an object of express module
app.get('/', function (req,res){ //create a call back function
    res.send('helloworld'); //send helloworld response
});
var server = app.listen(3000, function(){ make the server listen on 3000
   
});
----

1. using require function we are including the express module.
2. we need to make an object for the express module we just included.
3. create a callback function to be called whenever the user hits our root (/)
4. in the callback function, we are sending a response to the user
5. call a listen to function to make our server listens to client requests on port 3000.
done. use this web address to confirm.
localhost:3000/

Route (/):
routes reads clients input and responds to the request. say GET,POST,PUT,Delete

Friday, 17 January 2020

Access Modifiers in Maximo | IBM Maximo

To use these we need to import one class (from psdi.mbo import MboConstants)

NOACCESSCHECK
NOVALIDATION
NOACTION



mbo.setValue("DESCRIPTION", "Update a read only field", mbo.NOACCESSCHECK)

To update a field and not perform the validation and action events:

mbo.setValue("DESCRIPTION", "Update a field without validation or action", mbo.NOVALIDATION|mbo.NOACTION)

Putting all three together:

mbo.setValue("DESCRIPTION", "Please be careful doing this", mbo.NOACCESSCHECK|mbo.NOVALIDATION|mbo.NOACTION)

Copy value while Duplicating an MBO in automation script | IBM Maximo

 
<MBONAME>.DUPLICATE


or example in this case we will name it WORKORDER.DUPLICATE to intercept the duplicate event. The


mbo is this mbo. 
dupmbo is duplicated mbo. 

lets say we want to copy a value from workorder to the new duplicated workorder. 

create a script with this name, 
<MBONAME>.DUPLICATE

in our example we will name it WORKORDER.DUPLICATE to intercept the duplicate event.


dupmbo.setValue("copiedfrom", mbo.getString("wonum"))