Maximo Open Forum

 View Only
  • 1.  write autoscript to replace function of Webclient java class

    Posted 05-10-2023 22:51

    Hello experts,
    I have a WorkOrder UI , the bean class extends psdi.plusa.webclient.beans.workorder.PlusAWOAppBean, we need to replace the java function removevirtualasset with autoscript in python.  I did the convert,  it works for most of the cases, but has a defect. If the problem code in workorder is empty, and user fill in the problem code,  the follow-up workorder cannot be  created, cannot save. Maybe there are data errors in Problem code , but my java code works fine.  I attached the python and java code.
    My main changes  from Java to Python code replacement are as following:
    (WORemote)getMbo()       to 
    UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().getMbo();

    getMXSession().getMXServerRemote()   with
    UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().getMXSession().getMXServerRemote();

    this to the implicite variable mbo   

    super.save()   to  UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().save();

    this.app.getCurrentPageId()  to 
    UIContext.getCurrentContext().context.getWebClientSession().getCurrentPageId()

    this.sessionContext   to 
    SessionContext(UIContext.getCurrentContext().context.getWebClientSession())

    Please help, thank you in advance.
    Eric


    #Customizations
    #EverythingMaximo
    #MaximoApplicationSuite
    #MaximoUserGroups
    #Transportation

    ------------------------------
    Eric Zuo
    San Francisco Bay Area Rapid transit
    ------------------------------

    Attachment(s)



  • 2.  RE: write autoscript to replace function of Webclient java class

    Posted 05-11-2023 08:33

    If the problem code in workorder is empty, and user fill in the problem code,  the follow-up workorder cannot be  created, cannot save. Maybe there are data errors in Problem code , but my java code works fine.  
    - When you say it can't be created or can't be saved. Are you getting any error on UI or in Log? 



    ------------------------------
    Prashant Sharma
    Sedin Technologies
    Connect with me @ https://www.linkedin.com/in/psharmamaximo/

    #IBM Champion 2022
    #IBM Champion 2023
    ------------------------------



  • 3.  RE: write autoscript to replace function of Webclient java class

    Posted 05-11-2023 14:13
      |   view attached

    Hi Prashant,
    Thank you for your reply.
    After further test, actually, any change in work order before removal of virtual asset, will cause the same error. Need to exit the app, and the reload the workorder.
    The auto script REMOVEVIRTUALASSET replaces the java function REMOVEVIRTUALASSET which is called when click the OK button to submit the removal of virtual asset in a work order. 
    the error message:  
    BMXAA8229W - Record WORKORDER :  Site=BART Work Order=20114001 has been updated by another user. Your changes have not been saved. Refresh the record and try again. 
    Actually we saved the change before removal. If leave the problem code empty or the problem code is not empty at the beginning, it works fine.
    the full error message tree is attached.  
    In addition, today I commented a line of code:

            newMbo.getThisMboSet().save();    
            teststr="B.1";
            #woRemote.getThisMboSet().save();   // commented this line today, get the same error
            UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().save();

    Thanks,

    Eric



    ------------------------------
    Eric Zuo
    San Francisco Bay Area Rapid transit
    ------------------------------

    Attachment(s)



  • 4.  RE: write autoscript to replace function of Webclient java class

    Posted 05-16-2023 13:01

    Hi Eric, 

    Can you check the code snippet where you are calling save() in your Automation script? I think there lies the issue. 



    ------------------------------
    Subhransu Sekhar Sahoo
    Tata Consultancy Services
    ------------------------------



  • 5.  RE: write autoscript to replace function of Webclient java class

    Posted 05-17-2023 16:39

    HI Subhransu,
    I agree with you. In our customized work order App, (PlusAWOAppBeanBRT extends psdi.plusa.webclient.beans.workorder.PlusAWOAppBean), 
    Remove virtual Asset is a dialog.
    removvevirtualasset is the action in the java class called when click OK button to submit the removal.
    In the java, two save calls:                    
     newMbo.getThisMboSet().save();      // newMbo is the follow-up Work Order after removal the virtual asset,
     super.save();                                           // Super should be the class extended

    In the autoscript removvevirtualasset, 
     I interpreted the two save as following :
     newMbo.getThisMboSet().save();
     UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().save(); 
      
    I wonder my interpreter of the java super()  is correct. 
    Please forward instruction.

    Thanks,

    Eric



    ------------------------------
    Eric Zuo
    San Francisco Bay Area Rapid transit
    ------------------------------