Hey @Julio Roca i have tried the script and it works fine.
from psdi.server import MXServer
if mboname=='WORKORDER' and app=='WOTRACK' and mbo.getString('SITEID')=='BEDFORD':
mbo.setValue('DESCRIPTION','script triggered WOTRACK.new')
mbo.changeStatus("INPRG", MXServer.getMXServer().getDate(), "Status Changed from .NEW Script")
mbo.setValue('GLACCOUNT','6000-200-000')
wostatus=mbo.getMboSet('WOSTATUS')
------------------------------
Vivek Nagre
JLL
------------------------------
Original Message:
Sent: 10-20-2023 02:13
From: Julio Roca
Subject: Maximo Script - WORKORDER.NEW
Hello Steven,
Your explanation is right on target and now this works like a charm!
Thank you so much for your help!
JR
------------------------------
Julio Roca
BCBS
Original Message:
Sent: 10-19-2023 13:22
From: Steven Shull
Subject: Maximo Script - WORKORDER.NEW
When you're creating a work order, you normally will not have an owner. Think of the owner in the context of something like PR->PRLINE. If you had a script on PRLINE.NEW, then the PRLINE owner would be the PR header. You may be creating a WO specially where it does have a parent, but the second line there "workorder = mbo.getOwner()" is likely going to be null. You normally would just be using mbo. IE:
if mbo and mbo.isBasedOn("WORKORDER"):
------------------------------
Steven Shull
IBM
Original Message:
Sent: 10-19-2023 10:02
From: Julio Roca
Subject: Maximo Script - WORKORDER.NEW
Hello!
I'm trying to setup some default data on a new work order for a specific site but when I run the following script nothing happens, I don't get any error from Maximo and the fields are not populated with the default values. Any suggestions?
from psdi.server import MXServer
workorder = mbo.getOwner()
if workorder and workorder.isBasedOn("WORKORDER"):
if app == 'WOTRACK':
if mbo.getString("siteid") == 'BEDFORD':
mbo.setValue("STATUS", "INPRG", MboConstants.NOACCESSCHECK)
mbo.setValue("GLACCOUNT", "50020.200.5210")
#Administration
------------------------------
Julio Roca
BCBS
------------------------------