In most Maximo applications like Work Order Tracking or Assets, the list of selected records can get retrieved as follows:
myapp = service.webclientsession().getCurrentApp()
mboSet = myapp.getResultsBean().getMbo().getThisMboSet()
selectedRecords = mboSet.getSelection()
where service is an implicit variable automatically defined by the framework.
It could be a bit tricky to get selected records in uniquely designed applications like Assignment Manager. The way to figure it out is by decompiling and looking at the bean class.
Assignment Manager has 3 datasets on the same screen. Here is the code for getting the selected records for each one of them.
Assignments:
myapp = service.webclientsession().getCurrentApp()
assignMbo = myapp.getBeans()[0].getMbo()
if assignMbo:
selectedRecords = assignMbo.getThisMboSet().getSelection()
Labor:
myapp = service.webclientsession().getCurrentApp()
laborMbo = myapp.getBeans()[0].getAMLaborTableBean().getMbo()
if laborMbo:
selectedRecords = laborMbo.getThisMboSet().getSelection()
Crew:
myapp = service.webclientsession().getCurrentApp()
crewMbo = myapp.getBeans()[0].getAMCrewTableBean().getMbo()
if crewMbo:
selectedRecords = crewMbo.getThisMboSet().getSelection()
what is the trigger point for this automation script if I want to use this on list tab?
Hi,
You can create a new ‘Select Action’ menu item and trigger the automation script from there, for instance.
See this post for more details: https://umaranis.com/2021/08/06/adding-user-defined-operations-to-a-maximo-application/