Adding a bit to this response.
The service functionality around UI requires firing as an ACTION launch point (push button, select action, etc.). MBO level launch points (such as object save, attribute action/validate, etc.) don't typically interact with the UI. This is because the MBO represents the business logic and the bean classes represent the presentation layer. I tested and could not get the service.launchDialog to work on object save. But their option 2 did work, even from MBO launch points. I must admit this was new to me so I appreciate the tip.
I would always write logic to ensure it's interactive and in the app where you expect it to be though, otherwise REST API requests (including from mobile products like Anywhere) or updates caused by background processes are going to fail because they aren't interactive and you're trying to invoke UI functionality. On something like WO, you could be interactive and modifying it from the PM, Labor Reporting, Receiving, Inventory, etc. apps which wouldn't function as intended.
The dialog can be a dialog inside the app XML as mentioned. But Maximo also supports dialogs in other areas such as the LIBRARY XML. If you have a common dialog that you want to display in multiple apps you should put it in the LIBRARY XML and not specific applications. For example, there are various areas inside of Maximo that utilize the Expression Builder. Instead of building the dialog in each app, IBM puts it in the LIBRARY XML which is looked at after checking inside of the app. This allows it to function consistently in each app.
------------------------------
Steven Shull
Director of Development
Projetech Inc
------------------------------
Original Message:
Sent: Sat May 08, 2021 04:31 PM
From: User1971
Subject: Info about service.launchDialog(String dialogId)? (new in 7.6.1.2)
From a colleague:
This new method launchDialog(dialogId) has been added to ScriptService class.
It can be used to open the application dialogs (existing or custom), which are defined in application xml.
It takes dialog id as parameter.
1. Create a Object launch point automation script WO_TEST as below. Event Save->Add/update.
from psdi.common.context import UIContextfrom psdi.webclient.system.session import WebClientSessionManagerfrom psdi.webclient.system.controller import SessionContext, Utility, WebClientEventfrom java.lang.System import outout.println("start of script WO_TEST**************")c = UIContext.getCurrentContext().getWebClientSession()dialogId = "status"out.println("script WO_TEST**************"+dialog)service.launchDialog(dialogId)out.println("script WO_TEST**********after launchdialog**********")
2. Goto Work Order Tracking application and update any record, click save. System will open dialog 'Change Status' (dialogId passed as status).
This method can be used in script whenever we need to open pop-up dialog to the user after performing some logic.
Dialogs can also be opened without this method by using below code:
Utility().sendEvent(WebClientEvent("status", c.getCurrentPageId(), None, SessionContext(c)))
#Maximo
#AssetandFacilitiesManagement