Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
Expand all | Collapse all

UIContext class version 7.6.1.1 vs 7.6.1.3

  • 1.  UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Mon October 16, 2023 09:38 AM

    Hi,

    I was using the UIContext class in a script in Maximo 7.6.1.1 and it was working fine. We recently upgrade an environment to 7.6.1.3 and since then this part of my script is not working anymore.

    context = UIContext.getCurrentContext()
    if context:
        wcs = context.getWebClientSession()
        Utility().sendEvent(WebClientEvent("vdm_prop_motif", wcs.getCurrentPageId(), None, SessionContext(wcs)))

    The context is always null. I tried to get the "wcs" by using service.webclientsession() but as I saw in the javaclass, they also use the UIContext.getCurrentContext() so it also returns a null value.

    I also tried to launch the dialog using the service.launchDialog("vdm_prop_motif") but nothing happens.

    Is there any other way to access the UIContext ? Why it's not working anymore in 7.6.1.3 ? 

    Thank you



    ------------------------------
    Mathieu Guilmette
    ------------------------------


  • 2.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Tue October 17, 2023 04:11 AM

    Hi Mathieu,

    We have a pretty much identical jython script (apart from the dialog name), and it works fine in 7.6.1.3

    We also import these first.

    from psdi.common.context import UIContext
    from psdi.webclient.system.controller import SessionContext, Utility, WebClientEvent

    In a separate script we have also used:

    wcs = service.webclientsession()
    wcs.loadDialog("dialogname")

    So you could try that instead of trying service.launchDialog?

    Thanks

    Paul



    ------------------------------
    Paul Irving
    Product Development Manager
    BPD Zenith Ltd
    ------------------------------



  • 3.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Tue October 17, 2023 07:09 AM

    What is your launch point causing the automation script to fire? IE is this a push button calling an action launch point automation script or some other event? 

    I agree with Paul I haven't seen this issue. There was an issue with service.launchDialog in earlier versions that prevented it from working properly but it was fixed in 7.6.1.3 base. We switched it to actually use the loadDialog event that Paul mentions below. But these all depend on the UIContext not being null so if you're seeing it as null, none of them will work. 

    It may be worth opening a support case. We will not directly support automation scripts but if we're not setting this UIContext in a scenario where it should be set and had been setting before in earlier versions, it's something that might get approved. The decision would be up to L3 and the product manager. 



    ------------------------------
    Steven Shull
    ------------------------------



  • 4.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Tue October 17, 2023 12:50 PM

    Hi, our launchpoint is on object save After commit. Nothing special.

    I tried using the service.webclientsession() but it also returns nothing.

    I will try to make a new script much simpler on a different object to be sure that it's not another script that cause the issue.



    ------------------------------
    Mathieu Guilmette
    ------------------------------



  • 5.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Tue October 17, 2023 01:02 PM

    service.webclientsession() calls the same underlying UIContext so it is expected you would get similar results. 

    After commit is an unusual launch point but as a quick test, I did this in the SR application with the script below and it worked as expected. There were no changes to this class in 7.6.1.3 IFIXes but the version I am running is Tivoli's process automation engine 7.6.1.3-IFIX20230831-1702 Build 20220823-0909 DB Build V7613-344 HFDB Build HF7613-116 (7.6.1.3 IFIX 011). It is possible that another class file was modified that interacts with the UIContext 

    from psdi.common.context import UIContext
    if UIContext.getCurrentContext() is not None:
        wcs = service.webclientsession()
        wcs.loadDialog("viewhist")
    else:
        service.error("emx","contextNull")



    ------------------------------
    Steven Shull
    ------------------------------



  • 6.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Tue October 17, 2023 02:49 PM

    I tried your sample with a launchpoint object/save/after save on SR and it worked fine.

    I tried it with the same config but on the ASSET object and I got the error

    Can you try it using an ASSET launchpoint ? 

    Thank you



    ------------------------------
    Mathieu Guilmette
    ------------------------------



  • 7.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Thu October 19, 2023 04:45 PM

    Hi,

    I finally found what was the issue.

    We have spatial installed on these environments and with the latest upgrade, some scripts were added to Maximo.

    In my case, both script that ends with "_ASSET" were the reason that the UIContext is null. Don't know why yet. But if I deactivate both of them , it works fine.

    Do you think I should open a case to let them know ? I have to deactivate them so a feature won't properly work.

    Thank you for you help.



    ------------------------------
    Mathieu Guilmette
    ------------------------------



  • 8.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Fri October 20, 2023 11:03 AM

    Mathieu,

    I trust all is well. I would think that just because you have ended your autoscript in '_ASSET' it should not have an effect.  That said have you copied the script into a new one an renamed it something else to test that?  If it DOES take effect then I would most surely open a case.  There are VERY few cases in Maximo where the naming convention of an artefact would have any effect.  The limited ones I am aware of are domains and some of the default values.



    ------------------------------
    Bradley K. Downing , MBA
    Senior Brand Technical Specialist
    IBM
    Bakersfield CA
    ------------------------------



  • 9.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Fri October 20, 2023 01:23 PM

    As Bradley stated, the name of the script here should be irrelevant. For certain scripts (like OBJECTNAME.NEW) the name matters because that's how we find the script to launch. But in this case it's tied to a launch point so the name won't be important. 


    I can't imagine how the Spatial automation script would break the UIContext but if it works with those two disabled and you haven't modified the scripts, you should open a support case.



    ------------------------------
    Steven Shull
    ------------------------------



  • 10.  RE: UIContext class version 7.6.1.1 vs 7.6.1.3

    Posted Fri October 20, 2023 02:07 PM

    I opened a case, I will write here once the case is closed.

    Thank you



    ------------------------------
    Mathieu Guilmette
    ------------------------------