Showing posts with label UIcontext. Show all posts
Showing posts with label UIcontext. Show all posts

Wednesday, 23 December 2020

Invoke/Call any dialog from Automation Script | Maximo

Question:
Can we invoke/call my custom dialog or any dialog from the automation script, like we usually can trigger it from the Push button or from Select Action of the application 

Answer:

Yes, you can in the latest version 7.6.1. 

1. Get the dialog name from the application designer 
2. using below mentioned automation script to call it. 

In my example, I created one object launch point automation on the work order application to trigger automation. 
Below is the body of the automation in which I called one of the standard change status dialogs. 


from psdi.server import MXServer
from psdi.mbo import MboConstants
from psdi.common.context import UIContext
from psdi.webclient.system.controller import SessionContext, Utility, WebClientEvent
mxServer = MXServer.getMXServer()
userInfo = mxServer.getUserInfo("maxadmin")
vmbo = mbo.getString("wonum")
if vmbo == '30352551':
    context = UIContext.getCurrentContext()
    if context:
        wcs = context.getWebClientSession()
        Utility().sendEvent(WebClientEvent("status", wcs.getCurrentPageId(), None, SessionContext(wcs)))
        #service.error("",str(abc))



To Close a dialog, either use "okdialog" or in the newer version in can be done with 1 line of code:

service.closeDialog() 

Tuesday, 17 November 2020

Delete a Person from Person Groups (LIST VIEW QUERY) using Automation Script | Maximo

Requirement # 1:

How can we delete all persons from a list of PersonGroups except Group Default at once?

Requirement #2:

 How can we delete a specific person from all the listed person groups?

Solution:






  1. Create an Action Launch Point Script (let's say. DEL_PGTEAM)
  2. Open PERSONGR in application designer: 
    1. Create a Signature Option: DEL_PGTEAM., and choose "This is an action that must be invoked by the user in the UI" in the advance section
    2. Create Action with type Option with the same name as the signature option in step 1.
  3. Grant newly created signature option for specific Security Group.

Tuesday, 18 February 2020

Uses of UIContext (bean) via automation Scrip to Access List View Filterst | IBM Maximo

There are scenarios where you need to access the current List View filter (including QBE and user-applied conditions) directly from an Automation Script.

Maximo provides access to this information through the UIContext and the active Web Client session.

Therefore, The following snippet demonstrates how to retrieve the effective WHERE clause applied in the current application’s list view (including both user filters and QBE criteria).


Traditional Approach

from psdi.common.context import UIContext

wclause = UIContext.getCurrentContext().getWebClientSession().getCurrentApp().getResultsBean().getMboSet().getUserAndQbeWhere()

service.error("", wclause);

-----------
and now More Concise and Readable Approach:

from psdi.common.context import UIContext
wclause = service.webclientsession().getCurrentApp().getResultsBean().getMboSet().getUserAndQbeWhere()

------------