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.

No comments:

Post a Comment