Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Tuesday, September 13, 2016

Maximo Automation Script : To make field value to remove special characters and to make it in upper case

Below script is used to remove the special characters and make values in the field to uppercase

Script
------
Name : ASSET-DESCRIPTION-REMOVE-SPLCASE
Language : jython

Launch Points
-------------
Name : ATT-REMOVE-SPLCASE
Active : 1
Object : Asset
Attribute : DESCRIPTION

Autoscript
----------

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants
from psdi.util import MXApplicationException

logger = MXLoggerFactory.getLogger("maximo.script");
logger.debug("==================== ATT-REMOVE-SPLCASE." + launchPoint + ": START =====================")

#This script reformats the Description field to only have alphanumeric uppercase characters
#Characters A-Z and 0-9 inclusive are permitted.

description = mbo.getString("DESCRIPTION")
description = ''.join(i for i in description if i.isalnum())
description = description.upper()
mbo.setValue("DESCRIPTION", str(description), 2)

logger.debug("==================== ATT-REMOVE-SPLCASE." + launchPoint + ": END =====================")
----------------------------------------------------------------------------
All the messages
below are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Wednesday, August 26, 2015

Maximo Automation script .. How to find the parent Mbo and set value

Below is the sample code which can be used for finding the parent Mbo (ex invoiceline is parent for invoicecost) and setting values.I am using a attribute launchpoint on child mbo (ex invoicecost) which is called from invoiceline when filling gldebitaccout

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants


parentMbo=mbo.getOwner()
parentMbo.setValue("description","test", MboConstants.NOACCESSCHECK|MboConstants.NOVALIDATION_AND_NOACTION)



----------------------------------------------------------------------------

 All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Maximo Automation Script .. Split GL account

Below is the script which can be used for splitting the GL account to components

from psdi.mbo import MboConstants
from psdi.mbo import GLFormat
from java import util

 glComp1=mbo.getValue("gldebitacc").split('-')[0]
glComp2=mbo.getValue("gldebitacc").split('-')[1]
glComp3=mbo.getValue("gldebitacc").split('-')[2]

----------------------------------------------------------------------------

All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Wednesday, November 19, 2014

Sending mails using automation script in Maximo.




Here I am going to explain the process of sending mails from maximo automation script. Here I am taking example of sending emails whenever there is a change in status of work order.

 

·         Create a communication template like ‘WOSTATUS’

o   Template : WOSTATUS

o   Description :  Work order status change

o   Status: Active

o   Applies To : WORKORDER

o   Accessible From : ALL

o   Send From : maxadmin@xyz.com

o   Subject : WO :WONUM status changed

o   Description :  Workorder :WONUM has status changed.


 

·         Create launch point with details

o   Launch point : WOSTATUS

o   Description : status change launch point

o   Objective : workorder

o   Active – true

o   Add, initialize , update ,delete – true.






·          Create a automation script with below details

o   Script : wostatuscript

o   Script language : jython

o   Source code :

from psdi.util.logging import MXLogger

from psdi.util.logging import MXLoggerFactory

from psdi.mbo import MboConstants

from psdi.server import MXServer

 

logger = MXLoggerFactory.getLogger("maximo.script");

logger.debug("==================== wostatus." + launchPoint + ": START =====================")

 

user = mbo.getUserInfo()

mboServer = mbo.getMboServer()

commTemplateSet = mboServer.getMboSet("COMMTEMPLATE", user)

commTemplateSet.setUserWhere("TEMPLATEID = 'WOSTATUS' ")

commTemplate = commTemplateSet.getMbo(0)

 

if mbo.getMboValue("status").isModified():

    commTemplate.sendMessage(mbo)

 

 

logger.debug("====================wostatus" + launchPoint + ": END =====================")





----------------------------------------------------------------------------
All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Friday, October 31, 2014

IBM Maximo - Automation Script - Fetching OwnerName in automation script in Maximo ?


In  Maximo we can use the below jython script  to fetch Owner name of an mbo
logger.debug("=========================================)
if mbo.getOwner():
  ownerName = str(mbo.getOwner().getName())
  logger.debug("MBO Owner Name: " + str(ownerName))
logger.debug("=========================================)

----------------------------------------------------------------------------
All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Tuesday, July 21, 2009

how to make a field mandatory or required in maximo

Field Level Class

For example you want to make a SerialNum field in Asset Screen mandatory based on some requirement we need to modify in your specific class

getMboValue("SERIALNUM").SetRequired(true);

Automation Script

Similarly below script can be used to make a field required using Automation script.

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants

logger = MXLoggerFactory.getLogger("maximo.script");
logger.debug("==================== MandatoryAUTOSCRIPT  START =====================")
mbo.setFieldFlag("SERIALNUM",MboConstants.REQUIRED, True)
logger.debug("==================== MandatoryAUTOSCRIPT  END=====================")

Thursday, June 4, 2009

Configuring BIRT..issue "There are errors evaluating script"

The following items have errors:
ReportDesign (id = 1):
+ There are errors evaluating script "importPackage(Packages.com.ibm.tivoli.maximo.report.script);

mxReportScriptContext = MXReportScriptContext.initialize(reportContext);
mxReportScriptContext.setDefaultLogLevel("DEBUG");
mxReportScriptContext.setDefaultLogFile("c:/temp/asset.txt");".

Table (id = 7):
+ There are errors evaluating script "maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());
maximoDataSet.open();

var sqlText = "select assetid, siteid, assetnum, description, location, binnum, parent, assettype, "
+ " status, priority, itemnum, islinear, installdate, manufacturer, "
+ " assettag, budgetcost, ytdcost, totalcost, warrantyexpdate,purchaseprice, "
+ " replacecost, moved, changedate, failurecode, conditioncode from asset "
+ " where " + params["where"];

maximoDataSet.setQuery(sqlText);".
+ There are errors evaluating script "if (!maximoDataSet.fetch())
return (false);

We did some silly mistakes because of which we were getting this error.Our mistake was we were not using the recomended JDK version.Please use JJDK1.5 version to solve this issue