Maximo Open Forum

 View Only
  • 1.  Triggering automation scripts on errors

    Posted 01-04-2023 10:52
    For those of you interested, we have published a post on how to launch an automation script when an error occurs in Maximo.

    Hopefully you find it helpful.

    Sharptree | Blog | Responding to errors with an automation script.
    Sharptree remove preview
    Sharptree | Blog | Responding to errors with an automation script.
    While looking up documentation on how to properly obtain the display message for a Maximo exception we came across something quite interesting. In Maximo 7.6.1.2 a hook was added for triggering an automation script every time an error occurs.
    View this on Sharptree >


    #Administration
    #Architecture
    #Customizations

    ------------------------------
    Jason VenHuizen
    Sharptree
    ------------------------------


  • 2.  RE: Triggering automation scripts on errors

    Posted 01-04-2023 13:30
    Glad you like it and I really appreciate you sharing it. These types of features often go unnoticed because we don't do a great job publishing them out there. When Anamitra talked about adding it, I was extremely excited. There are scenarios where an error is a direct indicator of the health of the system (like a closed database connection error) and customers might want to send this to some sort of monitoring system. 

    On your scripts, you can simplify it a bit. UserInfo has a method getUserLoginDetails() that returns a UserLoginDetails object that has additional information about the user, including the first & lastname. We use this to build our whoami request for the REST API. You should be able to do something like:

    userInfo.getUserLoginDetails().getFirstName()

    That way you're operating with data in memory instead of opening a set.

    ------------------------------
    Steven Shull
    IBM
    ------------------------------



  • 3.  RE: Triggering automation scripts on errors

    Posted 01-04-2023 14:32

    I started out using:

    userInfo.getUserLoginDetails().getFirstName() 

    however I was getting a function not found error for the getFirstName() call. I tested it on 7.6.1.2 and 8.5 and had the same result with Javascript and Jython so I went the safer route and just looked it up.  I am not sure what the issue was as I used reflection and confirmed that the method was on the object that I had a reference to.  My best guess was that it was a security issue, but to make sure the examples worked I went with just looking up the person MBO.

    If you have any insights into why it might have been failing that would be great.

    Thanks,

    Jason



    ------------------------------
    Jason VenHuizen
    Sharptree
    ------------------------------



  • 4.  RE: Triggering automation scripts on errors

    Posted 01-05-2023 16:06

    Ah I missed that our UserLoginDetails class isn't declared as public so its methods can't be accessed outside of the package. It's terrible but you could do something like this:

    from com.ibm.json.java import JSONObject
    jsonObject=JSONObject()
    mbo.getUserInfo().toJSON(jsonObject,True)
    jsonObject.get("firstname")


    I opened an idea (https://ibm-ai-apps.ideas.ibm.com/ideas/MASM-I-876) because I think we should expose this information in UserInfo. Changing the access level of the UserLoginDetails class probably won't happen but we should add methods to the UserInfo to be able to return it.



    ------------------------------
    Steven Shull
    IBM
    ------------------------------



  • 5.  RE: Triggering automation scripts on errors

    Posted 01-05-2023 11:17
    This is really cool.  I love the examples.    You have ruined my productivity this morning as I think of ways to make use of this feature.  Thank you for sharing the concept.

    ------------------------------
    Bob Richardson
    A3J Group, LLC
    ------------------------------