Maximo Open Forum

 View Only
  • 1.  Auto Save Record

    Posted 11-01-2022 16:23
    Hi community, id like to hear what others have done when this questions has been proposed to them.

    We have a new custom object and custom application we created to keep track of data for our customer.  The group is new to maximo and often what they do is create a new record, start gathering data, then walk away from the system and eventually they will get timed out without saving their new record.  

    They are obviously not happy when they need to reenter data and we have told them to simply remember to save the record before they walk away, but the subject keeps coming up.  

    They are asking us to put in some type of autosave feature.  I can probably kick off using a run action off a specific attribute to call an mbo.getThisMboSet.save(), but this seems like bad practice.  I would rather my customer would just save the record before they walk off.  But I cannot think of any technical reason why the script would be bad practice.  My typical answer is, a save should be controlled conscious effort of the user, letting the system know that the data is in a state suitable to be saved.  This answer is not good enough and I'm wondering if there are any good technical reasons the community has used to not put in an autosave. 

    And of course if you have put in an autosave I would like to hear how you pulled it off, pros and cons etc. 

    Thanks for everything!

    Eric
    #MaximoApplicationSuite


  • 2.  RE: Auto Save Record

    Posted 11-02-2022 13:41

    I'll start with the technical and then wrap up with the functional.

    Indirectly, I highlighted a problem about this approach here: https://moremaximo.com/discussion/automatic-start-stop-asset-downtime-automation-script-is-blocking-wostatus-record#bm6da13bf0-6c2e-4716-bd45-1fc7f608ff50

    If you want to save the record you should save via the appbean and not the mbo. When your launch point is an action, you can do something like:

    appBean=service.webclientsession().getCurrentApp().getAppBean()
    appBean.save()

    service.webclientsession() won't be populated on Mbo level events (such as changing an attribute) but utilizing the UIContext typically works. You'd do something like:


    from psdi.common.context import UIContext
    appBean=UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getAppBean()
    appBean.save()

    This approach triggers a save on the set but then fetches the Mbo again so it can be saved again.


    With the technical out of the way... I hate the idea. Asking someone to save is a pretty common action in most web applications. I'm all for automating repetitive tasks but I don't view saving a repetitive task. Make sure they know how to use the keyboard shortcut to save as they may find that easier to add to their process.

    Unless you tie the launch point to every attribute, meaning you're saving field by field, this will only work some of the time. And if you do it field by field and there are validation issues (IE you need an ASSETNUM, LOCATION, or GL Account on a WORKORDER before you can save it), you'll be causing an error that interrupts the user flow. 



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