Maximo: How to fetch selected records from an Automation Script

Maximo: How to fetch selected records from an Automation Script

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()

Leave a Reply

Your email address will not be published.