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



Newest Episode
Ep. 4 | System Properties in IBM Maximo

Watch Steven Shull walk through practical IBM Maximo system properties that can improve usability, query behavior, attachment handling, and the overall Maximo user experience.

MORE by Naviam Episode 4 cover
Watch Episode 4
Also available: Ep. 3 | Work Order Role-Based Application