Sunday, 17 May 2020

Invoke/Call a Publish Channel Conditionally - Automation Script | Maximo


Normally trigger point for the Publish channels is Event Listener, which is save/update any record. 

Question: Can we send the data using publish channel with a custom trigger point /condition ??

Answer: Yes you can. by using Maximo Automation Script. 
Below is the simple tricks to call a publish channel 

server = MXServer.getMXServer()
userInfo = mbo.getUserInfo()
whereClause = <CONDITION>
server.lookup("MIC").exportData("<Publish Channel Name>", "<External System Name>", whereClause, userInfo, 1000)
---------------------------------
Another example:
micSrv = MXServer.getMXServer().lookup("MIC")
server.lookup("MIC").exportData("MXPO", "LegecyApp", " ponum='"+vPONum+"' and revisionnum="+vREVNUM , micSrv.getNewUserInfo() , 1)


Note:

Mic is old service name for MIF, but still the same name


Sunday, 10 May 2020

Creation of Yes / No User Input Dialog Validation for Custom Status using Automation Script || IBM Maximo

Today we are going to show you the creation of user user input dialog box for the custom status field. We have a custom application which has the custom status field, it changes the status of work order tasks based on this custom status. The requirement came when there was no validation when the user changed the status. We will show you how created validation dialog box using automation script.


1. Go to Database Configuration and create a message for user input

      Message Group:  os_taskstatus

      Message Key:      os_taskstatus

      Value:                Do you really want to change the status?

      Buttons:              Yes, No


2. Create Automation Script:

      Launch Point:    Attribute

      Events:          Validate

      Object:               WOACTIVITY

      Attribute:            ZZOSACTIVITYSTATUS

      Script:                  Jython

Wednesday, 6 May 2020

Maximo Cluster deployment Assigning names to JVMs as Generic JVM arguments.

In WebSphere you can set the mxe.name property directly on the JVM. This is done in the Generic JVM arguments for each individual JVM. This prevents each cluster from starting up with a random name e.g. mxserverc1. This way we can specify the cron tasks do not run properties at the instance level for each JVM in the database.

1. In your WebSphere Console, expand 'Server Types' and click on 'WebSphere Application Servers'. From here click on maximo_ui01.

2. Under 'Server Infrastructure'  expand 'Java and Process Management' and click on 'Process Definition'. Under 'Additional Properties' click on 'Java Virtual Machine'.

3. There will be a box that says 'Generic JVM arguments' in here we want to enter -Dmxe.name=maximo_ui01 as seen below.

-Dsun.rmi.dgc.ackTimeout=10000 
-Djava.net.preferIPv4Stack=true 
-Dmxe.name=maximo_ui01 

4- Repeat the above steps for your remaining JVM's.  For example Dmxe.name=maximo_ui02,Dmxe.name=maximo_mif01,Dmxe.name=maximo_rep01 and Dmxe.name=maximo_cron01.

 This should be done before deploying Maximo applications on cluster and then start you cluster.

Checking physical & Logical volumes or LPARS in AIX 7.1

To check Physical Volumes run below commands
lspv

To obtain a list of all the physical volumes known to a node and to find out the volume groups to which they belong, use the lspv command. If you do not specify the name of a volume group as an argument, the lspv command displays every known
physical volume in the system.

lspv hdisk2


To check Logical Volumes run below commands
 
To check the state of logical volumes defined on the physical volumes, use the lspv -l command and specify the logical name of the disk to be checked.

As shown in the following example, you can use this command to determine the names of the logical volumes defined on a physical volume.

lspv -l hdisk2




Thanks

for more details https://www.ibm.com/support/knowledgecenter/en/SSPHQG_7.2/trouble/ha_trgd_check_log.html

Restart Maximo JVMS,Nodes and DMGR (Nodes,DMGR,Syncnode)

Goto WAS ,Login from Wasadmin user, Stop all the JVMS (Maximo_u01,02,03,04, Cron01,Cron02,Rep01,Rep02,Mif01,Mif02)

Go to System administartion stop all Nodes.

------------------Stop Nodes--------------------------------------


Now access server and run following commands from both servers.

server01  , server02

path:server01

/app/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

./stopNode.sh -username wasadmin -password <password>

path:server02

/app/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

./stopNode.sh -username wasadmin -password <password>



------------------Stop DMGR------------------------------------------

Goto wasadmin DMGR Path

path:server01

/app/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/

./stopManager.sh -username wasadmin -password <password>


------------------Start DMGR-----------------------------------------

Goto wasadmin DMGR Path

path:mdrcqeamsapp01.qterminals.local

/app/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/

./startManager.sh -username wasadmin -password <password>




-----------------Sync Nodes---------------------------------------------
path:server01

/app/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

./syncNode.sh <DMGR HOSTNAME> 8879 -username wasadmin -password <password>


path:server02

/app/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

./syncNode.sh <DMGR HOSTNAME> 8879 -username wasadmin -password <password>

-----------------Start Nodes--------------------------------------------
path:server01

/app/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

./startNode.sh -username wasadmin -password <password>   (Password is needed to start Nodes)

path:server02

/app/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

./stopNode.sh -username wasadmin -password <password> (Password is needed to start Nodes)


-----------------Start All JVMS--------------------------------------- 
Once Nodes syncing is done, Go to JVMS and start all the JVMS.



 

Jacl script to Deploy Maximo application Manually using virtual Host.


Applications having build size more then 1 GB need to be deployed from wsadmin using JACL or Python script.
Below example is how to deploy Maximo Application using Jacl commands in DMGR.

Once Application build is done 
In my case I have four applications all with separate functionality.
maximo_ui , maximo_mif, maximo_rep, maximo_cron

after EAR built you will have ear file in default folder.
/app/IBM/SMP/maximo/deployment/default/
First Copy ear file (maximo_ui.ear).
Navigate to the WAS bin folder.
/app/IBM/WebSphere/AppServer/bin/
Paste maximo_ui.ear file within bin folder.

from terminal window (putty,mobaxterm,VNC)

Navigate to the
/app/IBM/WebSphere/AppServer/bin/

Run ./wsadmin.sh -username wasadmin -password wasadmin
DMGR will be login automatically.

wsadmin>

Now if application are already installed /deployed in WAS then you have to uninstall them.
Below are the commands to do it.

wsadmin>$AdminApp uninstall MAXIMO_UI
once uninstall done.
wsadmin>$AdminConfig save.

for REDEPLOY OR INSTALLING again.

wsadmin>$AdminApp install maximo_ui.ear { -usedefaultbindings -defaultbinding.virtual.host maximoui_host }


Make sure Virtual host is defined in Environment of WAS.

$AdminApp install maximo_mif.ear { -usedefaultbindings -defaultbinding.virtual.host maximomif_host }

$AdminApp install maximo_cron.ear { -usedefaultbindings -defaultbinding.virtual.host maximocron_host }

$AdminApp install maximo_rep.ear { -usedefaultbindings -defaultbinding.virtual.host maximorep_host }

Dont forget to issue save command at the end of installation finish.
wsadmin>$AdminConfig save.

 wsadmin>quit. 

Once done goto WAS.
Login from wasadmin.
Navigate to the deployed application (MAXIMO_UI) in Enterprise Applications.
Open Application and click on manage modules. to merge  application on cluster.
Also click on Virtual host to assign all the virtual hosts as well.

once Finish,Restart Nodes and DMGR.
Start JVMS.

For more Info visit below IBM tech Note:
https://www.ibm.com/support/pages/manually-completing-product-deployment




Friday, 1 May 2020

Refresh a Record by clicking the Button | Maximo

Sometimes data is  updated and we need to navigate back to the list view and re-open the record to see the updates,
or we copy the record id into the search field and hit search button to refresh. 

But with this trick, we can add Push Button we can refresh the record.

1. Refresh the Record, For Instance PR application

Drag Push button control and set these properties as below:

Label: Refresh PR 
Event: reset 
Target id: results_showlist



2. Refresh Child Record, For Instance PR Line Tab 

Monday, 27 April 2020

Attachment Functionality into your Custom Application | Maximo

1. Drag the attachment control in Application Designer
2. create a RELATIONSHIP to DOCLINK OBJECT

Application Name: Custom_App
Relationship: DOCLINKS
child Object: DOCLINKS
Where Clause: ownertable='Custom_App' and ownerid=:Custom_AppID
3. Enlist you custom application in APPDOCTYPE table, for that run this insert statement
INSERT INTO MAXIMO.APPDOCTYPE (APP, DOCTYPE, APPDOCTYPEID) VALUES ('Custom_App', 'Attachments', (NEXT VALUE FOR MAXIMO.APPDOCTYPESEQ));

Tuesday, 7 April 2020

Add Custom Modules to Go To Menu | Maximo

1. get max(MAXMODULESID) and add 20

select max(MAXMODULESID)+20 from maxmodules ; --42+20


now INSERT in MAXMODULES using the value from step 1.

Insert into MAXMODULES ( MODULE, DESCRIPTION, MAXMODULESID) values ('QMS', 'Quality Management System', 62)


2. get max(MAXMENUID) and add 200

select max(MAXMENUID)+200 from maxmenu; --18779+200


3. get max(POSITION) and add 1000

select max(POSITION)+1000 from maxmenu; --96033+1000


4. now INSERT in MAXMENU using the values from step 2 and 3.

Insert into MAXMENU (MENUTYPE, MODULEAPP, POSITION, SUBPOSITION, ELEMENTTYPE, KEYVALUE, HEADERDESCRIPTION, VISIBLE, IMAGE, MAXMENUID)

values ('MODULE', 'QMS', '97033', 0,'MODULE', 'QMS', 'Quality Management System', 1,'atb_bookmark.gif', 18979)


Monday, 2 March 2020

how to use wildcard characters and Operators in Maximo

Maximo Wildcard Usage Examples.


* or %  
Substitutes for a string of characters
123* or 123% find records that start with 123, such as 123, 12345, and 123ABC.


? or _
Substitutes for a single character
123? or 123_ find any four-character records that start with 123, such as 1234, 1230, 123g.

When searching in a date field you can precede the date with a > (greater than), < (less than), or =

This only works when there is one window to search for a date (not two)  

~null~   searches for records that do not have an entry for the particular field.

!=~null~   searches for records that have an entry for the particular field.
 



Operator action Use

ampersand (&)  And

Find records that contain at least one occurrence of all of your query terms. The operator must be placed between two query terms.

hyphen (-)

Minus

Find records that contain one query term, but you want the presence of your second query term to cause the document to be ranked lower in the result set. The operator must be placed between two query terms.

pipe (|)

Or

Find records that contain at least one occurrence of any of your query terms. The operator must be placed between two query terms.

semicolon (;)

End of SQL command line

Indicate the end of a SQL command line.

tilde (~)

Not

Find records that contain one query term and not another. The operator must be placed between two query terms.


equals (=)

Exact match

Find records that are an exact match to your query. For example, filtering records with a status of "APPR" also returns records that have a status of "WAPPR" unless you type "=APPR" in the status field.

Not equals (!=)

Not match

Find records that are not a match to your query. For example, filtering records with a status of "!=WAPPR" finds records that do not have a status of “WAPPR”.

Friday, 28 February 2020

Find Records Between Specific DateTime Range | SQL

This Query is written in DB2 with Maximo on Workorder table, but I believe its the same for almost all.


SELECT w.reportdate
,to_date(to_char(CURRENT timestamp-1,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' ) yesterday
,to_date(to_char(CURRENT timestamp,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' ) today
FROM WORKORDER W
WHERE 1=1
--FETCH FIRST 10 ROWS ONLY
AND W.reportdate BETWEEN to_date(to_char(CURRENT timestamp-1,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' ) AND to_date(to_char(CURRENT timestamp,'YYYY-MM-DD')||' 05:00:00','YYYY-MM-DD HH24:MI:SS' )

for Oracle: Use Sysdate instead of Current Timestamp

Tuesday, 25 February 2020

Utilization of Logging in Maximo

FATAL - A message logged at FATAL level indicates that the error is very severe and will cause the application not to function at all. This level is used only by the Maximo application framework code to indicate that the Maximo application failed.

ERROR - A message logged at ERROR level indicates that the application would continue to run, but a specific functionality that's processed by the current thread failed and would continue to fail until the processing information is altered.

WARN - A message logged at WARN level indicates that the application would continue to run, but a specific functionality that's processed by the current thread may be operating on some data that might not be appropriate.

INFO - A message logged at INFO level indicates a general message that highlights the progress of the specific functionality that's processed by the current thread.

DEBUG - A message logged at DEBUG level indicates a general message that provides fine-grained information about the progress of the specific functionality that is being processed by the current thread.

NOTE: The DEBUG level is used to log messages that are useful for customers, support and development to diagnose problems in detail, but it is extremely verbose and should be used sparingly.


FATAL > ERROR > WARN > INFO > DEBUG

This means that if a logger is enabled for INFO level, it would accept FATAL, ERROR, WARN level messages and discards DEBUG level messages.



For more info please check this IBM Tech note Logging in Maximo

Tuesday, 18 February 2020

Check Budget with Oracle ERP Through Publish channel and set flag 1 or 0 on PR and PO.

Check Budget with Oracle ERP Through Publish channel and set flag 1 or 0 on PR and PO.

Create End point for publish channel that needs to be used for Publish channel with ERP.

Publish Channel Endpoinnt = MEP

Define external system and publish channel for outbound transactions and Enterprise Service for inboaund transactions

Publish channel  = BDGT_CHECKINTERFACE
Enterprise Service = BDGTCHK_POINTERFACE

once everything is done for integeration side
Send request to ERP through automataion below.


create script with action launch point.
object = 'PO' , object = 'PR' in launch points.


import sys
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants
from psdi.util.logging import MXLogger
from psdi.iface.mic import MicService
from psdi.server import MXServer
from psdi.mbo import *
from psdi.webclient.system.session import WebClientSession
from time import sleep
from psdi.security import UserInfo
from psdi.server import MXServer

Uses of UIContext (bean) via automation Script | IBM Maximo

from psdi.common.context import UIContext

wclause = UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().getMboSet().getUserAndQbeWhere()

service.error("", wclause);

Monday, 10 February 2020

Reconfigure DB2 after a Windows Hostname Change | DB2

1. replace the hostname in db2nods.cfg file at (c:\programdata\ibm\db2\db2copy\db2inst\)

2. open command prompt with admin rights and run these 2 commands to enable editing in registry

db2extsec –r

db2extsec /a DB2ADMNS /u DB2USERS

3. open registry editor (regedit), find and replace host name in all values

HKEY_LOCAL_MACHINE\Software\IBM\DB2


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"))