Sunday, 27 October 2024

Custom Line Number Functionality using Automation Script | IBM Maximo

We have a custom Object, LE_WPP, which has multiple lines and a foreign key from its parent Object, LE_WPPAYMENTID. We also have an attribute called Linenum.

We will execute the attribute launch point when the foreign key (LE_WPPAYMENTID) inserts by default, when we click on the new row button.


Launch Point Type: Attribute

Object: LE_WPP

Attribute: LE_WPPAYMENTID (Foreign Key)

Script:

vWPPAYMENTID=mbo.getString('LE_WPPAYMENTID')

vWPP=mbo.getThisMboSet()

vWPP.setWhere("LE_WPPAYMENTID = "+ vWPPAYMENTID+"") 

vWPP.setOrderBy("LE_PROGRESSID , LINENUM ");

#vcount=vWPP.count()

maxLineNum  = 0

vWPP1=vWPP.moveFirst()

Thursday, 8 August 2024

Asset Deletion Query Sql | IBM Maximo

To delete asset totally from system including all related tables in Maximo System.

Single Asset Delete Query Example:

delete from AMCREWTOOL where ASSETNUM='WAP-0071';
delete from AMCREWWOTL  where ASSETNUM='WAP-0071';
delete from AREASAFFECTED where AFFECTEDASSETNUM='WAP-0071';
delete from ASSET  where ANCESTOR='WAP-0071';
delete from ASSET  where ASSETNUM='WAP-0071';
delete from ASSET  where PARENT='WAP-0071';
delete from ASSET where PLUSTALIAS='WAP-0071';
delete from ASSETANCESTOR  where ANCESTOR='WAP-0071';
delete from ASSETANCESTOR  where ASSETNUM='WAP-0071';
delete from ASSETAUDIT  where ASSETNUM='WAP-0071';
delete from ASSETCALIBRATION  where ASSETNUM='WAP-0071';
delete from ASSETFEASPECHIST  where ASSETNUM='WAP-0071';
delete from ASSETFEATURE  where ASSETNUM='WAP-0071';
delete from ASSETFEATUREHIST  where ASSETNUM='WAP-0071';
delete from ASSETFEATURESPEC  where ASSETNUM='WAP-0071';
delete from ASSETHIERARCHY  where ASSETNUM='WAP-0071';
delete from ASSETHIERARCHY  where PARENT='WAP-0071';
delete from ASSETHISTORY  where ASSETNUM='WAP-0071';
delete from ASSETLOCCOMM  where ASSETNUM='WAP-0071';
delete from ASSETLOCRELATION  where SOURCEASSETNUM='WAP-0071';
delete from ASSETLOCRELATION  where TARGETASSETNUM='WAP-0071';
delete from ASSETLOCRELHIST  where SOURCEASSETNUM='WAP-0071';
delete from ASSETLOCRELHIST  where TARGETASSETNUM='WAP-0071';
delete from ASSETLOCUSERCUST  where ASSETNUM='WAP-0071';
delete from ASSETMETER  where ASSETNUM='WAP-0071';
delete from ASSETMNTSKD  where ASSETNUM='WAP-0071';
delete from ASSETOPSKD  where ASSETNUM='WAP-0071';
delete from ASSETSPEC  where ASSETNUM='WAP-0071';
delete from ASSETSPECHIST  where ASSETNUM='WAP-0071';
delete from ASSETSTATUS  where ASSETNUM='WAP-0071';
delete from ASSETTOPOCACHE  where SOURCEASSETNUM='WAP-0071';
delete from ASSETTOPOCACHE  where TARGETASSETNUM='WAP-0071';
delete from ASSETTRANS  where ASSETNUM='WAP-0071';
delete from ASSETTRANS  where FROMPARENT='WAP-0071';
delete from ASSETTRANS  where TOPARENT='WAP-0071';
delete from ASSETWORKZONE  where ASSETNUM='WAP-0071';
delete from AUTOATTRUPDATE where ASSET='WAP-0071';
delete from CI  where ASSETNUM='WAP-0071';
delete from COLLECTDETAILS  where ASSETNUM='WAP-0071';

Thursday, 30 May 2024

Send Email from Automation Script, Multiple ways | Maximo

 1. Here’s a simple, famous 3-line code snippet to send an email. This example uses a communication template, but the body (MESSAGE) can be dynamically modified as needed

    ctMboSet = mbo.getMboSet("$commtemp","COMMTEMPLATE"," TEMPLATEID ='COE_SCHEDULED' ");

    ctMboSet.setQbeExactMatch("true")      

    ctMboSet.reset()

    ctMbo = ctMboSet.getMbo(0)

    ctMbo.setValue("MESSAGE", txtres)

    if(ctMbo is not None):

        ctMbo.sendMessage(mbo,mbo);