Showing posts with label autoscript. Show all posts
Showing posts with label autoscript. Show all posts

Tuesday, September 13, 2016

Discardable MBOSET / MBO in IBM Maximo

·         These can be used on MBOSETS which are used for traversing forward only ie looping in
·         They should not be used while doing edit/save etc operations
·         Mboset will not cache the MBOs as it fetches from directly from database. This will minimise the JVM memory usage.
·         Discardable Mbo Sets are always read only.

Example below to make a MBOset discardable

MboSetRemote personSet = getMboSet("PERSON");
personSet.setFlag(MboConstants.DISCARDABLE, true);




----------------------------------------------------------------------------
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, July 20, 2016

Maximo : Populating ownergroup with a person group a user belongs to

 Below script is used to populate a field (Owner Group) in work order application with logged in users person group.

Launch point 
------------------
Name : KS_OBJ_OWNERGROUP
Desc : Launch Point for User
Intialize = Y
Condition : 
Object : WORKORDER

Autoscript :
Name : KS_OWNERGROUP
Desc : Load person group

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("====================KS_OWNERGROUP." + launchPoint + ": START  =====================")
mboServer = mbo.getMboServer()
user1 = mbo.getUserInfo()
personGroupQuery = "persongroup in (select distinct a.persongroup from persongroup a, persongroupteam b  where b.RESPPARTYGROUP = '"+user+"' and rownum<2 div="">
personGroupMboSet = mboServer.getMboSet("persongroup",user1)
personGroupMboSet.setWhere(personGroupQuery)
personGroupMboSet.reset()
if not personGroupMboSet.isEmpty():
 personGroupMbo=personGroupMboSet.getMbo(0)
 mbo.setValue("OWNERGROUP",personGroupMbo.getString("persongroup"),MboConstants.NOACCESSCHECK|MboConstants.NOVALIDATION_AND_NOACTION)
logger.debug("====================YYZ_OBJ_USERGROUP." + 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.

Tuesday, April 26, 2016

using array in Maximo Automation script


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

logger = MXLoggerFactory.getLogger("maximo.script");
logger.debug("==================== ATT_WO_WOPRIORITY." + launchPoint + ": START =====================")

# declaring as a set of double values
arrSubDiv = array([1,2,3,4,5,6],'d')

woPriority = mbo.getDouble("WOPRIORITY")

for i in arrSubDiv:
 if (i==woPriority):
   mbo.setFieldFlag("JUSTIFYPRIORITY",MboConstants.REQUIRED, True)
else:
   mbo.setFieldFlag("JUSTIFYPRIORITY",MboConstants.REQUIRED, False)


logger.debug("==================== ATT_WO_WOPRIORITY." + 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.

Monday, April 11, 2016

Maximo automation script... Jython code similar to string Starts with


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

logger = MXLoggerFactory.getLogger("maximo.script");
siteVar=str(mbo.getMboValue("SITEID"))
## Below line does action similar to starts with in string. It compares if site variable starts with KSK or not, if it doesnt start it alerts the user
if(siteVar[:len("KSK")] <> "KSK"):
 logger.debug("Site validation")
 errorgroup = "Site"
 errorkey ="Checksite"


ref : Reference Link


----------------------------------------------------------------------------
 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.