Maximo

 View Only
  • 1.  Run automation script on demand

    Posted Thu September 09, 2021 08:59 AM
    Edited by System Test Wed March 22, 2023 11:44 AM
    MAM 7.6.1.2:

    Is it possible to run automation scripts on demand?

    Kind of like a Python interactive shell in Maximo.





    Related: Maximo bulk update from List view
    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: Run automation script on demand

    Posted Thu September 09, 2021 09:01 AM
    Edited by System Test Wed March 22, 2023 11:47 AM
    It looks like the answer is yes, using the Execute action in the Automation Scripts application.






  • 3.  RE: Run automation script on demand

    Posted Thu September 09, 2021 09:03 AM
    What does "Std" mean in "Stdout" and "Stderr"?

    Does it mean "standard"? If so, what's the explanation behind that?

    Thanks.


  • 4.  RE: Run automation script on demand

    Posted Thu September 09, 2021 12:14 PM
    Edited by System Test Wed March 22, 2023 11:56 AM


  • 5.  RE: Run automation script on demand

    Posted Wed October 20, 2021 09:40 AM
    Edited by System Test Wed March 22, 2023 11:46 AM
    https://stackoverflow.com/a/60191596/10936066

    "It is not supported, but you can create and grant yourself an EXECUTE sig option in the autoscript application. This will enable an Execute action, allowing you to execute a script on demand. However, because no launch point was used to provide context, implicit variables and other context that you may be used to will not be available.

    "On Demand Autoscript" is what I call a script that I develop with the intention of being executed from that Execute action. I have written On Demand scripts for doing things like resynchronizing nested workflows or preparing our data for an upgrade. On Demand scripts, though created the same way, are different from what the 7.6 documentation calls "Library scripts" in that, even though Library scripts aren't (necessarily) called from their own Launch Points, the script that calls them does usually provide some context / implicit variables.

    An On Demand Autoscript usually looks something like this, which you can look up documentation on in the Maximo API JavaDocs.

    from psdi.server import MXServer
    server = MXServer.getMXServer()
    security = server.lookup("SECURITY")
    userInfo = security.getSystemUserInfo()
    
    mboSet = server.getMboSet("SOMEOBJECT", userInfo)
    try:
        mboSet.setWhere("somecol = 'somevalue'")
        mbo = mboSet.moveFirst()
        while mbo:
            print "do something with mbo %s: %s" % (
                mbo.getUniqueIdentifer(), mbo.getString("DESCRIPTION"))
    
            mbo = mboSet.moveNext()
    
        if "applicable":
            mboSet.save()
    
    finally:
        if not mboSet.isClosed():
            mboSet.close()
    

    From the above, it should be plain that you can easily "write a script that loops through records in a table and updates values based on certain criteria. And I can execute it on demand."




  • 6.  RE: Run automation script on demand
    Best Answer

    Posted Sat November 06, 2021 02:01 PM
    Edited by System Test Wed March 22, 2023 11:51 AM

    Instructions for running an automation script on-demand (adding the EXECUTE sig option):

    1. Application Designer --> AUTOSCRIPT:

      • Create an EXECUTE sig option (Add/Modify Signature Options)
      • Option: EXECUTE
      • Description: Execute Script
      • Advanced Signature Options: None
    2. Ensure that your security group has that EXECUTE sig option in the Automation Scripts application:

    3. Log out of Maximo and back in again (to update your cached permissions with the change that was just made).

    4. Create an automation script

      • (Without launch points?)
      • Automation Scripts application --> Create --> Script
    5. Open the automation script.

    6. The Execute Script action will appear in the left pane. Use it to run automation scripts on demand.



    #AssetandFacilitiesManagement
    #Maximo


  • 7.  RE: Run automation script on demand

    Posted Fri June 23, 2023 10:09 AM

    Does the above script always run as the MAXADMIN user?

    How do you get the logged on user?



    ------------------------------
    Stephen Christie
    ------------------------------