Maximo Open Forum

 View Only
  • 1.  Maximo Script - WORKORDER.NEW

    Posted 10-19-2023 10:21

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


  • 2.  RE: Maximo Script - WORKORDER.NEW
    Best Answer

    Posted 10-19-2023 13:23

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



  • 3.  RE: Maximo Script - WORKORDER.NEW

    Posted 10-20-2023 04:04

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



  • 4.  RE: Maximo Script - WORKORDER.NEW

    Posted 12-31-2023 00:09

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



Featured Podcast
Episode 1 is live: IBM Maximo Application Suite 9.2

Watch or listen to Steven Shull and Phil Runion discuss the practical MAS 9.2 updates Maximo teams should know.

Watch the Podcast
MORE by Naviam Episode 1 cover
Watch the latest episode