Send email from automation script

Simple stuff but I got a few people asked me this same question, so here is how to create an automation script to send email from Maximo:

1 - Create a Communication Template:

  • Template ID: MY_COMM_TEMPLATE
  • Description: Test Communication Template
  • Applies To: ASSET
  • Send From: <your_email@address> (Note: to make this work, you must have setup smtp and able to send email from Maximo first
  • Subject and message as shown below

  • In the "Recipients" tab, add an Email recipient pointing to your own email:




2 - Create an Automation Script with Object Launch Point on the "ASSET" object, on the SAVE (Update) event, choose Language = Python and copy/paste the following sample script:

from psdi.server.MXServer import getMXServer as MXS
if mbo.isModified("status") and mbo.getString("status") == "INACTIVE":
commTpltSet = MXS().getMboSet("COMMTEMPLATE", MXS().getSystemUserInfo())
commTpltSet.setWhere("templateid='MY_COMM_TEMPLATE'")
commTpltSet.reset()
commTpltSet.getMbo(0).sendMessage(mbo, mbo)
view raw send_email.py hosted with ❤ by GitHub
3 - Open an Asset then change its status to INACTIVE, you should receive an notification in your email inbox:



No comments:

Post a Comment