Maximo Integration

  • 1.  Refreshing the UI field

    Posted Tue December 15, 2020 02:21 PM
    I have a custom application and custom object. The application has a table with a details section and toggledeleterow for each row. I created an automation script using object launch point and event Allow Object Deletion.
    When the user clicks the garbage can to delete the record, the script checks if the record being deleted is referenced anywhere else.

    If it's not, the row is marked for deletion and the UI show that row with a strike through. This works, just like a standard delete button.

    If the record is used somewhere else, the script sets the field record status to inactive and displays a message letting the user know the record can't be deleted, but it was set to inactive instead.
    mbo.setValue("RECSTATUS","Inactive");
    logger.debug("NOT Allowed to Delete - itemsFound = "+str(itemsFound))
    errorgroup = "CRDB"
    errorkey = "CANTDELETE"
    When I close the message, the save button is enabled, but the record status fields still show active. If I click on save, the record is saved in the database and UI is updated. Both the table and the table details now show record status inactive.
    I need some indication to the user that the field was updated and the record needs to be saved.

    I add MboSet().save() before showing the message. So when I close the message, the save button is disabled, but only the record status field in table details gets updated. The table column for record status still says active. If I refresh the search parameters then the field in the table gets updated.
    mbo.setValue("RECSTATUS","Inactive");
    logger.debug("NOT Allowed to Delete - itemsFound = "+str(itemsFound))
    mbo.getThisMboSet().save()
    errorgroup = "CRDB"
    errorkey = "CANTDELETE"

    What am I doing wrong? Is there a better way to get this done?


    ------------------------------
    Luiz Robertto Mello
    ------------------------------


  • 2.  RE: Refreshing the UI field

    Posted Wed December 16, 2020 10:12 AM
    I created a case to IBM in early 2019 where any time an error is thrown from an automation script and the script changed other values the UI doesn't reflect the underlying MBO changes, even if you explicitly call a save. They rejected it because it involved an automation script and thus unsupported and I didn't have time to come up with an out of the box method to make changes and get the same result. 

    General UI issues around actions occurring in a script (such as adding new MBOs to a set not showing automatically even if you use the set name in 7.6.1.1 of Maximo) are frustrating and it's strange to me when it works and when it doesn't. You may have better luck than I did if you try and open a case. I don't know of anything better to suggest unfortunately.

    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------



  • 3.  RE: Refreshing the UI field

    Posted Wed December 16, 2020 11:17 AM
    Hello! 
    I am not clear enough on the description of the problem you provided. 
    I had the situation when I created a custom table related to WO. When I made some changes on that custom table and saved WO, it saved the records of that custom table, but it didn't perform actual update of WORKORDER record in DB, as result it didn't update Rowstamp for WO. It was an issue for me, because if 2 users work on the same WO and make some changes on that custom table, it allowed to save WO for both and didn't throw the error "The record was updated by another user...".
    Another issue, that I needed refresh for UI for SERVRECTRANS table and for my custom related table.

    So, I found solution which worked for me:

    1. Refresh of UI (I used it in Java bean class for dialog):

    this.parent.fireDataChangedEvent();
    this.parent.fireStructureChangedEvent();
    this.parebt.fireChildChangedEvent();

    2. To forse WO to be updated in DB together with the custom table records, in order to update WO Rowstamp and do not allow 2 users save the same child set simultaneously.

    ownerWORemote.setModified(true);
    ownerWORemote.getThisMboSet().save(); -
    I needed WO to be saved right after I click OK button on the dialog.

    https://www.ibm.com/support/pages/marking-main-record-modified-while-modifying-related-child-records-automation-scripts-v76

    Sorry if it's something different that you needed.
    But maybe it can be helpful.



  • 4.  RE: Refreshing the UI field

    Posted Thu December 17, 2020 12:49 PM

    @Andrii Batyrenko, thank you for the suggestions. I couldn't figure out how to use fireDataChangeEvent() in an automation script. I did try using mbo.setModified(True) followed by mboSet.save(). It had the same result unfortunately. The UI gets updated and the records is saved, except when I launch an error message. service.error() or errorgroup / errorkey behave the same. If either of those follows the mbo action, the UI does not get updated. Sounds just like the issue @Steven Shull described.

    Thank you all though. I'll abandon the functionality to set the record inactive and just notify the user the record can't be deleted. 



    ------------------------------
    Luiz Robertto Mello
    ------------------------------



  • 5.  RE: Refreshing the UI field

    Posted Thu December 17, 2020 02:11 AM
    Edited by Andreas Brieke Thu December 17, 2020 02:13 AM

    Hi,

    i needed a confirmation message from a List-Script and used this method for it:

    service.webclientsession().showMessageBox(msggroup,msgkey,params)
    This just shows a messagebox, perhaps this helps.



    ------------------------------
    Andreas Brieke
    IT Service Management Consultant
    SVA System Vertrieb Alexander GmbH
    ------------------------------



  • 6.  RE: Refreshing the UI field

    Posted Thu December 17, 2020 12:22 PM

    @Andreas Brieke, I couldn't get showMessageBox to work. When I passed (msggroup,msgkey,params) I got a message that the first argument couldn't be coerced to event. But when I passed (service.webclientsession().getCurrentEvent(),msggroup,msgkey,params) I got a message that the first argument couldn't be coerced to string.

    I don't know if it would work though, because I need the error to stop the delete.

    Thank you for the recommendation.



    ------------------------------
    Luiz Robertto Mello
    ------------------------------



  • 7.  RE: Refreshing the UI field

    Posted Thu December 17, 2020 08:47 AM

    Hi Steven, thank you for the reply. It sounds exactly like what I am experiencing.

    I setup a second automation script to flip the status field, without showing the error. Which is working 95% of the time. Don't know why sometimes even that one doesn't update the UI.

    I'll try just showing a message as Andreas suggested. 

    Thanks again.



    ------------------------------
    Luiz Robertto Mello
    ------------------------------