Maximo

Maximo

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

 View Only
  • 1.  Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 14 days ago

    I'm wanting to force users to add an attachment if one doesn't exist in a specific attachment folder when they go to complete a work order, so I'm trying to get the "Add New File" dialog (id draddnewattachmentfile) to pop up.

    I've tried to invoke service.launchDialog("draddnewattachmentfile"), which launches the dialog ok.... just with invalid bindings. It seems to behave as if it's ignoring the DOCLINKS relationship since the "DESCRIPTION" attribute is the only component that doesn't have an invalid binding - it's grabbing that from WORKORDER.  I wasn't sure if this was due to me initially firing it from the WOCHANGESTATUS object, but I've tried firing it from WORKORDER as well and get the same results. I then tried just sticking the event on a push button and throwing it on the work order - same results. 

    This obviously works fine if I go to it through the normal Attachments menu, but if I try to invoke the dialog through a script or the event from a push button, I get invalid bindings.



    ------------------------------
    Brandon Fisher
    ------------------------------


  • 2.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 13 days ago

    Please provide script for that part.

    Are getting context in that script?



    ------------------------------
    Juris Flugins
    Expert IT Consultant
    TROIA d.o.o
    Jurmala
    ------------------------------



  • 3.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 13 days ago

    The script is just:

    service.launchDialog("draddnewattachmentfile")

    I've tested it on a simple attribute automation script so that it fires on the change of the worktype attribute on workorder.



    ------------------------------
    Brandon Fisher
    ------------------------------



  • 4.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 13 days ago

    Haven't tested, but there should be context provided in script, es in this example

    https://community.ibm.com/community/user/discussion/info-about-servicelaunchdialogstring-dialogid-new-in-7612



    ------------------------------
    Juris Flugins
    Expert IT Consultant
    TROIA d.o.o
    Jurmala
    ------------------------------



  • 5.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 13 days ago

    I did see that - and what Steven wrote is likely the issue (it doesn't work at an mbo level). I did try that other option I think you're referring to with the referenced context. It didn't work, either - in Steven's scenario, he did it from an object launch point so I'm guessing it is something that doesn't work from an attribute launch point.



    ------------------------------
    Brandon Fisher
    ------------------------------



  • 6.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 12 days ago

    OK, will try to find time to check this, how it works, and what can be done.



    ------------------------------
    Juris Flugins
    Expert IT Consultant
    TROIA d.o.o
    Jurmala
    ------------------------------



  • 7.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 12 days ago

    Hi

    This worked for me on work order tracking:

    from psdi.webclient.system.controller import WebClientEvent,PageInstance,ComponentInstance
    from psdi.webclient.system.session import WebClientSessionManager, WebClientSession;
    
    
    if yourcondition here:
        wcs = service.webclientsession()
        if wcs is not None:
    
            wcs.getCurrentEvent().setProcessed()
            wcs.getCurrentEvent().cancelRender()
            appl = wcs.getCurrentApp()
            page = appl.getCurrentPage()
            source = page.getComponentInstance("doclinks-ti")
            wce = WebClientEvent("addnewattachmentfile", "doclinks-ti", None, wcs, source)
            wce.setRow(-1);
            wce.addParameter("qrydesc", "Add New File");
            wcs.queueEvent(wce)


    ------------------------------
    Paul Irving
    Chief Product Officer
    Naviam
    ------------------------------



  • 8.  RE: Opening the Attached Docs "Add New File" dialog from an automation scripts

    Posted 12 days ago

    Thanks!  That worked.

    Is there an easy way to set a value in the dialog after it opens (I'm wanting to set the doctype)? I can probably take care of it via another automation script, but figured I'd check to see if there is an easy way to just do it in this same script since it seems like there should be. I haven't got into these UI level scripts before and am not sure where some of this comes from (like that "doclinks-ti" component instance and the parameter).



    ------------------------------
    Brandon Fisher
    ------------------------------